Pattern Matching in Java Deep Dive
summary
Walks through what is actually usable now in JDK 21: record deconstruction patterns and pattern matching in instanceof and switch, plus scoping rules for binding variables and sealed types enforcing exhaustiveness. Notes null handling differences and that switches can throw a runtime exception when compile-time exhaustiveness differs from runtime values. Points out the underscore pattern is a preview feature, primitive-type patterns and a reconstruction expression for mutating-by-rebuilding records are work in progress, and a VS Code extension (NetBeans/JavaC-based) is published.
AI-written summary · about
chapters (11)
- 0:00Introduction and speaker background
- 3:05Pattern matching fundamentals and examples
- 12:34Pattern matching in if statements and loops
- 13:20Pattern matching in switch expressions
- 17:02Type test and deconstruction patterns
- 22:23Null handling in pattern matching
- 29:35JDK 21 features and preview updates
- 32:07Future pattern matching enhancements
- 36:22Custom deconstruction and reconstruction
- 41:01VS Code Java extension announcement
- 43:22Q&A session
related talks
56mThe Art of Java Language Pattern Matching
39mPattern Matching: Small Enhancement or Major Feature?
29mThe Art of Java Language Pattern Matching
22mPattern Matching
52mPattern Matching: Small Enhancement or Major Feature?
46mThe Art of Java Type Patterns
46mThe Art of Java Type Patterns
54mPattern Matching in Java: Past, Present, Future
