Sunday, May 8, 2022

JDK 11 Features

JDK 11 New Features 


1] Java 11 adds a few new methods to the String classisBlanklinesstripstripLeadingstripTrailing, and repeat.

2] Files class has two new methods readString and writeString static methods.

3] Collection interface has new method toArray()

4] A static not method has been added to the Predicate interface. 

5] Lambda will allow local variable.

6] HttpClient :- New HttpClient improves performance and supports both Http1, Http2, WebSocket.

7] jdk10 :- Collections got immutable methods like Set.of, List.of,  List.copyOf etc

8] jdk 9:- Interface can now have private methods.

9] jdk 12:- String class has 2 new methods -- indent, transform

10] jdk 12:- File.mismatch,

11] jdk 12:- New Formatter class CompactNumberFormat to represent number in short form in given locale.

12] jdk12:- New switch expression. No need of break statement

13] jdk12:- instanceOf method

14] jdk13:- in switch expression value can be returned using yield.

15] jdk13:- String block can be represented using 

       """  

                  <Text Paragraph>

      """

16] jdk14:- Record -- Can create simple data mojo class without boilerplate.

         public record Person(String name, int age) {

}

17] jdk15:- sealed class, permit  

18] jdk16: Stream.toList