Programming LanguagesExplainerJava records, sealed classes and pattern matching explained with examples
Records model data, sealed types close an inheritance hierarchy, and pattern matching branches on the exact type. This explainer shows how the three fit together, with one runnable example and the compile errors you will meet.
