Clean Code with Records, Sealed Classes and Pattern Matching

The releases of the JDK 17 to 19 bring interesting features in the Java language: sealed types, pattern matching for switch (as a preview feature). Along with the introduction of records, the implementation of pattern matching in the Java language begins to take shape. The JDK 19 brings even more with Record pattern matching (as a preview feature), that further simplifies your code. In this presentation we show you how records are working, how you can use them to make your code much more readable, and how you can leverage sealed types and switch expressions to improve the modularity of your application. You will see pattern matching in action on real examples, how it will change the way you write Java code, and what you can expect on this topic in the future. It is mostly a live coding presentation, with some slides when the code shown cannot be executed.

Recorded at Devoxx 2022