~/talk

The Art of Java Language Pattern Matching

Talkat XtremeJ 2023 · on Tuesday, 2023-11-07· [java, compilers-and-language-design]
slides:none on file

Explains how Java now binds pattern variables in instanceof and switch, showing actual code shapes: type patterns with automatic cast, guarded patterns using when (added around JDK 19/20), explicit record patterns for deconstruction, composable nested patterns, and unnamed variables (_ and var) finalised in JDK 21/22. Covers case null, primitive-array cases (primitives await Valhalla), sealed-class completeness to avoid defaults, and compile-time pattern dominance rules that reject unreachable cases. Claims concrete benefits: fewer casts/boilerplate, clearer deconstruction, and potential JIT optimizations as the runtime adapts.

AI-written summary · about

  1. 0:00Introduction to pattern matching
  2. 2:11Instance of pattern matching
  3. 9:36Switch pattern matching
  4. 15:16Sealed classes and completeness
  5. 16:24Guarded patterns in switch
  6. 20:40Record pattern matching
  7. 25:15Unnamed variables and patterns
  8. 27:42Summary and future features
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.