java from 8 to 16
Java 16 is released and it’s time to leave our good ol’ Java 8
and begin to use the new language features Java brings with its versions.
In this post, I will only cover some of the newest Java features.
Java 9
Private methods in interfaces
New Optional APIs
New Future APIs
New Collection APIs
JShell
Jigsaw
Java 9 also brings the Project Jigsaw whose goal is to
have a standard module system for the Java Platform.
This is a large topic that I will not cover here.
Java 10
Inference type
New Optional APIs
New Collection APIs
Java 11
Inference type on lambda
New String APIs
New Files APIs
New HttpClient APIs
Java 12
New Switch expressions
Java 13
Switch expressions enhancements
To have this feature, you need to add a flag to enable it:
Text blocks
Finally…
Java 14
Pattern matching for instanceof
Records
Helpful NullPointerExceptions
JPackage
Java 15
Sealed classes
Java 16