Java · Hard · Pro
Nested record patterns — deconstructing DTO graphs in switch?
JavaJava 21+Senior
Nested record patterns
Pattern matching can deconstruct nested records in one switch—flatten DTO graphs without manual getters.
- Syntax:
case Point(int x, int y)inside outer case.