~/talk

Pattern Matching in Java: Better Code, Better APIs

Talkat JavaOne 2025 · 2025-03-18..03-20· [java, software-architecture]
links:none on file
slides:none on file

Java moves common instance-of + cast + visitor boilerplate into declarative patterns so a four-step ad hoc test becomes a three-line query using Java 24 features: record patterns for nested decomposition, switch expressions with pattern cases and exhaustiveness via sealed classes, plus underscore wildcards. Records provide transparent construction and pattern-based deconstruction; non-record classes can declare deconstructors to enable the same matching and simplify null handling and serialization (feature used by Victor Clang’s data‑oriented serialization). Primitive patterns are a 24 preview.

AI-written summary · about

  1. 0:00Pattern matching intro
  2. 7:58Records and basics
  3. 10:30What are patterns
  4. 12:54Records as carriers
  5. 14:00Record patterns
  6. 16:08Switch expressions
  7. 20:41Sealed classes
  8. 23:06Unnamed variables
  9. 24:08Primitives matching
  10. 27:16Beyond deconstruction
  11. 33:58Data-oriented summary
  12. 35:44Q&A
~/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.