Java Lambda Expressions: Simplifying Functional Interfaces

Whats the story of lambda expressions? 1. Functional interfaces are interfaces which have only one abstract method, can have static and default methods. 2. Sometimes we dont want to implement an interface by creating a new class. 3. Java gives us anonymous inner classes for it which implement the interface inline. 4. In places where a functional interface is expected we can pass anonymous function (as implementation of abstract method), its type checked against the functional interface and java uses it to create an instance of functional interface. 5. A very cleaner way to write an anonymous function in java is lambda expression. #java #backend

To view or add a comment, sign in

Explore content categories