Jep406

1 post in this section

Pattern Matching for switch (JEP 406): Type Dispatch in switch (Preview)

Preview Feature in Java 17 (JEP 406 — First Preview). Requires --enable-preview. This feature evolved through Java 18 (JEP 420), Java 19 (JEP 427), Java 20 (JEP 433), and was finalized in Java 21 (JEP 441). The Java 21 final version has minor syntax differences from this Java 17 preview — documented below. Enabling Preview Features Pattern matching for switch requires --enable-preview in Java 17. Add to your build tool:

Continue reading »