~/talk

The Art of Java Language Pattern Matching

Talkat Devoxx Ukraine 2023: AI – Friend or Foe? · on Friday, 2023-09-22· [java]
slides:none on file

Java adds concrete pattern features: instanceof pattern lets the compiler bind and flow-scope variables (JDK14); switch expressions accept type and null cases and must be exhaustive; records + sealed classes create algebraic types usable in record deconstruction (JDK19) and guarded patterns with the contextual when keyword; JDK21 introduces unnamed pattern variables (_) to ignore parts during nested deconstruction. The talk demonstrates compiler checks for pattern dominance, shows why named-record-patterns were dropped (ambiguity), and notes array deconstruction is proposed but not yet implemented.

AI-written summary · about

  1. 0:00Welcome
  2. 1:07Pattern matching basics
  3. 5:22Switch expressions evolution
  4. 10:35Java records and ADTs
  5. 16:55Sealed classes rules
  6. 20:27Pattern matching with instanceof
  7. 28:53Pattern matching in switch
  8. 34:49Guarded patterns
  9. 41:35Pattern matching for records
  10. 48:00Named record patterns removal
  11. 51:52Future array deconstruction
  12. 53:18Summary
~/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.