New language features in Java 17
In the middle of September, Java 17 got released. This is the new LTS (Long Term Support) version, replacing Java 11. In this article I am going over the changes in the language that happened since Java 11. Java is definitely still on the move and in more than one direction.
―𝐢𝐧𝐬𝐭𝐚𝐧𝐜𝐞𝐨𝐟 𝐩𝐚𝐭𝐭𝐞𝐫𝐧 𝐦𝐚𝐭𝐜𝐡𝐢𝐧𝐠
―𝐏𝐚𝐭𝐭𝐞𝐫𝐧 𝐦𝐚𝐭𝐜𝐡 𝐟𝐨𝐫 𝐬𝐰𝐢𝐭𝐜𝐡
Since the last LTS, Java has seen many language improvements. While some of these are more standalone there is definitely a coherence discoverable between switch pattern matching, sealed classes and records.
Oracle has recently decided that it will release an LTS version every two years from now on. This used to be three years. So the next LTS version will be Java 21.
With so many new and exciting features added to the language you should feel encourages to upgrade your existing projects to the latest Java version.
The code examples in this article plus some additional examples can be found in my GitHub repository.