Java sealed classes and exhaustive pattern matching
Java 17 introduced sealed classes, which allow you to explicitly list the allowed sub-types of an interface or base class. For example, here’s a toy example using a sealed interface and reco...
https://neilmadden.blog/2026/04/24/java-sealed-classes-and-exhaustive-pattern-matching/