The Art of Java Type Patterns
summary
Covers concrete language changes and gotchas: introduces JEP 305 pattern matching for instanceof (JDK 14/16) and JEP 406 pattern matching for switch (JDK 17), demonstrates record deconstruction and sealed classes (JDK 15) to make pattern switches exhaustive, and shows the compiler auto-inserting a case null that throws NPE unless explicitly handled. Explains flow scoping, dominance/order of cases, var-in-pattern proposals, that array patterns (JEP 405) were withdrawn, and a jshell binding-name bug versus javac.
AI-written summary · about
chapters (28)
- 0:00Intro
- 0:34Modern Java
- 2:45Pattern Matching In Java
- 3:23Pattern Matching Fundamentals
- 4:47Pattern Types
- 6:39Switch Expressions
- 7:57Switch Statement
- 8:55Switch Expression (JDK 12)
- 10:42Simple Java Data Class
- 11:27Records (JDK 14)
- 12:25Records Additional Details
- 13:34Java Inheritance
- 14:15Sealed Classes (JEP 360)
- 16:47Using The instanceof Operator
- 18:22Pattern Matching For instanceof (JDK 14)
- 21:34Flow Scoping For Binding Variables
- 24:09Pattern Matching For instanceof Puzzler
- 29:39Pattern Matching for switch (Completeness)
- 31:41Guarded Patterns
- 32:47Pattern Dominance
- 34:21Pattern Matching instanceof And Records
- 35:03Pattern Matching For Records (JEP 405)
- 36:11Patterns Are Composable
- 38:24Patterns And Local Variable Type Inference
- 39:11Using The Any Pattern Match
- 40:51Pattern Matching For Arrays
- 42:43Azul Zulu Builds of OpenJDK
- 44:34DEVOX
related talks
46mThe Art of Java Type Patterns
29mThe Art of Java Language Pattern Matching
56mThe Art of Java Language Pattern Matching
55mThe Art of Java Language Pattern Matching
39mPattern Matching: Small Enhancement or Major Feature?
50mPattern Matching in Java Deep Dive
25mBrewing Patterns in Java - An Informal Primer
54mPattern Matching in Java: Past, Present, Future
