The Art of Java Language Pattern Matching
summary
Project Amber adds concrete language features: Pattern matching for instanceof (JEP 433) and Pattern matching for switch (JEP 441) plus record patterns, unnamed variables and primitives in patterns (JEP 455), with record deconstruction cutting a 14-line point class to one line and JShell revealing a surprising variable-shadowing bug; switch expressions (JDK 12) enforce exhaustiveness with sealed classes, null cases are auto-inserted, guarded patterns use the contextual keyword when (can be confusing), and Platform Prime claims 43% more transactions per second by swapping the JVM.
AI-written summary · about
chapters (12)
- 0:00Introduction to Java pattern matching
- 2:31Switch expressions in Java
- 7:04Java records and algebraic data types
- 10:36Sealed classes and inheritance
- 12:20Pattern matching with instanceof
- 21:11Pattern matching in switch statements
- 27:57Guarded patterns and dominance
- 35:30Pattern matching with records
- 41:16Unnamed pattern variables
- 44:10Primitive types in pattern matching
- 46:40Autoboxing and type matching edge cases
- 52:51Summary and future of pattern matching
related talks
27mPattern Matching for Java
56mThe Art of Java Language Pattern Matching
46mThe Art of Java Type Patterns
46mThe Art of Java Type Patterns
29mThe Art of Java Language Pattern Matching
43mHow Amber is Driving Java’s Evolution
39mPattern Matching: Small Enhancement or Major Feature?
54mPattern Matching in Java: Past, Present, Future
