You are on page 1of 2

Java 8 Features

Lambdas : (a,b)-> {return a+b};

Streams : Stream, parallelstream, stream().parallel() , Methods of stream : Map, filter, forEach, limit, sorted,
distinct, collectors

Predicates: Predicate <A> nullCheck= feature->(feature!=null)

aList.removeIf(nullCheck)

Optional : Optional<Data> dataOptional= Optional.ofNullable(x.getData());

Date Time API : Immutable now, Seperation of concern, utility operations, clarity, and extendible

Completable Future

Executors now use Work Stealing Pool

IO improvements: Files.list(), Files.lines(), Files.find()

Comparator new methods : thenCompare(method).collect(Collectors.to List())

Default methods with multiple inheritance

Java 9 Features
Java 9 REPL Shell

Factory methods for Immutable Set. List, Map, Map.Entry : Using list.of (1,2,3)

Private methods in interfaces

Try with resource improvements : try(reader){//do something}

Completeable future improvements : completeableFuture.delayedExecutor(50, sec).supplyAsync()….

Reactive streams : pub sub framework

No Diamond operator usage instead of use new List<Employee>(emp), now use new List(emp)

Optional Class Improvement : can work with streams

Stream API improvements : StreamOf(1,2…10).takeWhile(i->i<5).forEach(sout(i)), dropwhile()

HTTP2 client Improvement : uses java nethttp 1.1 and 2 support


Java 10 Features
6 month release model adapted

LTS model released

Inferring of value : var value= List.of(1..10)

Unmodifiable Collection copyOf, to Unmodifiable

Java 11 Features

Run java file with one command

New string Methods lines(return stream), strip(remove whitespace (Unicode aware)), repeat

Local Var syntax for lambda

Epsilon : A NOOP gc allocator used for performance testing etc

Removed Java EE and CORBA module

Flight Recorder for app diagnostics and profiling

New File Methods : files.readString(path), files.writeString(path), files.createTempFile(“name”,”text”)

Java 12 Features
Switch case improvement: No Need of break everywhere. Can take multiple cases and return value

You might also like