-
String Templates (Preview Feature)
String Templates allow us to embed expressions (variables, methods or fields) into Strings, which are evaluated at runtime.
private static String name = "T2P"; private static String message = STR."Greetings from \{name}!"; //Greetings from T2P!
-
Virtual Threads
Virtual Threads are JVM managed lightweight threads. Lighter than the traditional Threads.
Executors.newVirtualThreadPerTaskExecutor();
-
Sequenced Collections
New interface Sequenced Collection is introduced in the Collections framework which provides new functionality of defined encounter order, which means, we will have a well-defined order for first element, second element, upto the last element.
List<Integer> integerList = new ArrayList<>(); integerList.add(100); //[100] integerList.addFirst(50); //[50,100] integerList.addLast(150); //[50,100,150] integerList.getFirst(); //50 integerList.getLast(); //150