Skip to main content
PreparationZone Logo
PreparationZone
Back to Java

Java · Hard · Pro

Nested record patterns — deconstructing DTO graphs in switch?

JavaJava 21+Senior
Model answerPreview

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.