Java releases

Java 8

March 2014

Stream API and Optional

New foreach() method for Iterable and Consumer

Default and static methods in interfaces

Interface i = () {...}

Java Time API (java.time Local/Timezone)

New ConcurrentHashMap and Atomic vars


Java 9

September 2017

New module system

module blog {
 exports com. [..]
 exports cms
}

Multi-release jars, allowing to create alternate versions of classes and libraries.

JShell, interactive Java REPL.

Collections factory methods:

   Set<Integer> ints = Set.of(1,2,3)
   List<String> strings = List.of("a","b","c")

Stream API improvements:

   dropWhile, takeWhile, ofNullable interate(..,..,..,).foreach() 

Private interface methods

public interface MyInterface {
  private void init (){ ....}
}

Java 10

March 2018

Local variable type inference:

var myVar = new HashMap<String,String>
- right hand target doesn't require target type

Java 11

September 2018

Standart Http client (java.net.http)

Local variable syntax for lambda parameters:

(var a) -> a < 5

Java 12

March 2019

New Switch expression