Java SE 17 was released in September 2022 as the next long-term supported version from Oracle. Therefore, it is expected that many of us will quite soon migrate from Java 11 to 17.
In this project, we go through the new APIs available in Java 17, compared to the ones available in Java 11. We focus on changes that are most relevant for developers. Other new features like security enhancements, garbage collector updates or performance improvements are not demoed here.
We cover the following new APIs with examples:
- Text Blocks – make our multiline strings more readable
- Pattern Matching for InstanceOf – create variables with instance-of checks
- Records - create immutable data classes with ease
- Sealed Classes - finer control of our class extendibility
- Stream toList Method – reduce boilerplate for the most common collector
- NullPointerExceptions – helpful messages that ease debugging
- Switch Expressions – using arrow functions and getting rid of breaks
- Pattern Matching for Switch – unfortunately only in preview mode
- New Random Number Generators - better API design and new generators avaliable