Package modernfeatures.java21
Class PatternMatchingSwitchNestedDemo
java.lang.Object
modernfeatures.java21.PatternMatchingSwitchNestedDemo
Demonstrates Java 21+ pattern matching for switch with nested record patterns.
This example showcases how to use pattern matching in switch expressions
to handle various shapes, including nested groups of shapes.
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
PatternMatchingSwitchNestedDemo
public PatternMatchingSwitchNestedDemo()
-
-
Method Details
-
main
Demonstrates pattern matching with nested groups and various shapes. Creates an array of shapes including simple shapes and nested groups, then uses a switch expression with nested patterns to describe each shape.
-