Class PatternMatchingSwitchPreviewExamples
java.lang.Object
net.jrodolfo.java_evolution.java17.PatternMatchingSwitchPreviewExamples
Demonstrates pattern matching for
switch as a Java 17 preview
feature.
Before pattern matching for switch, type-based branching often required a
chain of if, instanceof, and casts. That scattered the
dispatch logic across multiple statements.
Pattern matching for switch solves this by letting a switch branch on type patterns. It became final later, in Java 21. This project compiles on JDK 25, so the example uses final syntax while documenting the Java 17 preview origin.
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
PatternMatchingSwitchPreviewExamples
public PatternMatchingSwitchPreviewExamples()
-
-
Method Details
-
describe
-