Class RecordPatternsPreviewExamples
java.lang.Object
net.jrodolfo.java_evolution.java19.RecordPatternsPreviewExamples
Demonstrates record patterns as a Java 19 preview feature.
Records made data-carrier classes concise, but extracting values still required accessor calls after checking the type. Record patterns solve that by letting code match and deconstruct a record in the same expression.
Record patterns became final later, in Java 21. This project compiles on JDK 25, so the example uses final syntax while documenting the Java 19 preview origin.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordSmall record used by the record pattern example. -
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
RecordPatternsPreviewExamples
public RecordPatternsPreviewExamples()
-
-
Method Details
-
describe
-