Java 11 is the first long-term support (LTS) release after Java 8. Oracle also stopped supporting Java 8 in January 2019. So it becomes mandatory for the application teams to onboard to Java 11 ASAP.
some of the new features include,
new methods/API to the String class: isBlank, lines, strip, stripLeading, stripTrailing, and repeat.
easier way to read and write Strings from files using readString and writeString static methods from the Files class.
Path filePath = Files.writeString(Files.createTempFile("tempDIR", "demo", ".txt"), "Javapedia.net");
String fileContent = Files.readString(filePath);
System.out.println(fileContent); // prints Javapedia.net
The java.util.Collection interface adds a new default toArray method which makes it easy to create an array from a collection using its right data type.
List myListCollection = Arrays.asList("orange", "Apple");
String convertedArray = myListCollection.toArray(String::new);
addition of Predicate.not method like Predicate.not(String::isBlank)),
addition of support for using the local variable syntax (var keyword) in lambda parameters,
The new HTTP client from the java.net.http package was introduced in Java 9. It has now become a standard feature in Java 11.
We don't have to compile the Java source files with javac explicitly anymore, we can directly run the file using the java command:
Nest-Based Access Control.
Java 11 introduced the Z Garbage Collector (ZGC).