Skip to main content

Posts

Showing posts from November, 2017

Java 8 Features

Java 8 features was released on 18th March 2014 and we need to be on top of it. In this tutorial, we will look into Java 8 features with examples. ----------------------------------------------------------------------------- Java 8 features : 1. Lambda Expression 2. Method references 3. Interface changes: Default and static methods 4. Streams 5. StringJoiner class with example 6. Stream filter 7. forEach() Method 8. Functional interfaces 9. Optional class with example 10. Collectors class with example 11. Arrays Parallel Sort

Lambda Expression

Java Lambda Expressions Lambda expression is a new and important feature of Java 8. It provides a way to represent one method interface using an expression. This expression will help to iterate, filter and extract data from collection. The Lambda expression provides an implementation of an interface which has functional interface. It saves a lot of code. When we use lambda expression, we don't need to define the method again for providing the implementation. We just need to write the implementation code. .class file is not created for lambda Expression as compiler treat this as function. Functional Interface Lambda expression provides implementation of functional interface. An interface which has only one abstract method is called functional interface. Java provides an anotation @FunctionalInterface, which is used to declare an interface as functional interface.