Java 10 New Features
Java SE 10 was released in March 2018. The full list of new features in JDK 10 can be found here: http://openjdk.java.net/projects/jdk/10/ In this tutorial, we will look at some of these new features and examine some of them. 1. JEP 286: Local-Variable Type Inference To decrease the boilerplate coding, Java 10 introduces local-variable type inference feature. With this feature it is not mandatory explicitly declaring the type of a local variable. Instead, the compiler infers the type of the expression. Without JEP 286: List<String> list = new ArrayList<>(); Stream<String> stream = list.stream(); With JEP 286: var list = new ArrayList<String>(); var stream = list.stream(); 2. JEP 307: Parallel Full GC For G1 The G1 garbage collector was made the default in JDK 9. However it uses a single threaded mark-sweep-compact algorithm. With Java 10, G1 now does full GC in parallel. The number of threads used during parallel phases of the...