Tagged “Pattern-Matching”
2 articles with this tag.
- Records, sealed & patternsData-oriented programming in modern Java: records, sealed classes and interfaces, pattern matching for instanceof and switch, record patterns, exhaustiveness, unnamed variables, text blocks and var, plus what Java 22–27 added (flexible constructor bodies, module imports, compact source files, primitive patterns in preview).
- VisitorAdd new operations to a stable class hierarchy without changing its classes. Double dispatch explained, a runnable Java 21 shape hierarchy with area and SVG-export visitors, and the modern alternative: sealed interfaces with exhaustive pattern-matching switch. The expression problem and trade-offs.