Pattern Matching in Java (17)

Pattern Matching is finding its way into Java, one step at a time, along three paths: patterns, switch improvements, sealed classes. Let's see how they all come together.

Wavy white lines on off-white material - very abstract

Pattern Matching is finding its way into Java, one step at a time, along three paths:

  • support for patterns

    • starting with type patterns (in Java 16)
    • next are deconstruction patterns (candidate for preview in Java 18)
  • improvements of switch

    • making it an expression (in Java 14)
    • supporting patterns (preview in Java 17)
  • sealed classes (in Java 17)

In this presentation, we'll follow these three paths to see them all come together for a happy end. We'll also discuss when (not) to use pattern matching, so you can make the right choices from day one.

Slides

Here's the current version of the slides.

I also embedded them below. If they're focussed, you can navigate with arrow keys or swipes (they're two-dimensional, with chapters on the horizontal axis and chapter content layed out vertically). Use Page Up/Down for linearized order and ? for more shortcuts.

Video

Here's a good recording of the talk. I hope you'll like it.

Always embed videos

(and give me a cookie to remember - privacy policy)

Watch on YouTube

Past Presentations

I gave this talk once before. See below for links to slides (as they were at that very event), videos, and other information.

2021