#Java #OpenJDK #PatternMatching #JDK18
Conversation with Project Amber lead Brian Goetz about pattern matching in Java: Why `Map::get` should be a pattern, the linear thinking trap and how it impacts null handling in pattern matches, exhaustiveness in switch statements and the rehabilitation of `switch`.
Links:
* Project Amber:
https://openjdk.java.net/projects/amber/
* discussion about handling null with total patterns:
https://mail.openjdk.java.net/pipermail/amber-spec-experts/2022-January/003194.html
https://mail.openjdk.java.net/pipermail/amber-spec-experts/2022-February/003240.html
Table of Contents:
0:00 Intro
0:16 Map::get should be a pattern
4:10 `null` in patterns and the linear thinking trap
10:56 Exhaustiveness for switch statements
16:28 Rehabilitating `switch`
19:30 Goodbye