Java 8 – Lambda expressions

Lambda Expressions:

New addition to Java 8 – Lambda Expressions.

Lambdas will mainly remove the ceremonious syntax from anonymous class declaration.

Method reference will further simplify it removing some more syntax from the code.

Check below code. It clearly shows the classic way of anonymous class declaration & how the syntax can be reduced to achieve same code using lambdas & method reference.

Output:

 

Leave a Reply

Your email address will not be published. Required fields are marked *