Agenda for this blog is to explore Java 8 features which was a big update that changed the way developer writes code. It helps developer to write clean and concise code, improved abstraction and enhance their productivity. Lets start with a brief introduction of each update which was added in java 1.8 and then go deepr to undertand the concept along with the code example.
1: Lambda Expression (λ)
The Main Objective of Lambda Expression is to bring benefits of functional programming into Java. Lambda expressions are similar to methods but without name.
👉Lambda Expression is just an anonymous (nameless) function. That means the function which doesn’t have the name, return type and access modifiers.
👉Lambda Expression also known as anonymous functions or closures.
An interface that contains only one abstract method is known as Functional Interface. Because, exactly only one abstract method is mandatary to mark an Interface as as a Functional Interface & due to this naure it is also known as a Single Abstract Method interface (SAM).
Predicate is a functional interface which represents aboolean-valued function of one argument and present in java.util.function. It is used to test objects whether they satisfy certain conditions or not (true or false).