0% found this document useful (0 votes)
37 views2 pages

Java 8 Features: Distinct, Collectors

The document outlines key features introduced in Java 8 through Java 12, including lambda expressions, streams, optional classes, and improvements to the Date Time API in Java 8; REPL shell and factory methods in Java 9; a six-month release model and type inference in Java 10; new string methods and file handling in Java 11; and switch case enhancements in Java 12. Each version brings significant enhancements aimed at improving code clarity, performance, and ease of use. Overall, these updates reflect Java's evolution towards more modern programming practices.

Uploaded by

Gaurav Chaudhary
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views2 pages

Java 8 Features: Distinct, Collectors

The document outlines key features introduced in Java 8 through Java 12, including lambda expressions, streams, optional classes, and improvements to the Date Time API in Java 8; REPL shell and factory methods in Java 9; a six-month release model and type inference in Java 10; new string methods and file handling in Java 11; and switch case enhancements in Java 12. Each version brings significant enhancements aimed at improving code clarity, performance, and ease of use. Overall, these updates reflect Java's evolution towards more modern programming practices.

Uploaded by

Gaurav Chaudhary
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

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)

[Link](nullCheck)

Optional : Optional<Data> dataOptional= [Link]([Link]());

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

Completable Future

Executors now use Work Stealing Pool

IO improvements: [Link](), [Link](), [Link]()

Comparator new methods : thenCompare(method).collect([Link] List())

Default methods with multiple inheritance

Java 9 Features
Java 9 REPL Shell

Factory methods for Immutable Set. List, Map, [Link] : Using [Link] (1,2,3)

Private methods in interfaces

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

Completeable future improvements : [Link](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= [Link](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 : [Link](path), [Link](path), [Link](“name”,”text”)

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

You might also like