JAVA 8 – Lambda Expressions for SDETs


Lambda expression is a new feature introduced in Java 8. It has brought functional programming capabilities to JAVA and is one of the most popular features of Java 8. Lambda expressions are used to create instances or objects of functional interfaces. A functional interface is an interface with a single abstract method (we already have interfaces like Runnable, Callable, ActionListener, etc.). A lambda expression can be expressed as an anonymous function with no name and doesn't belong to any class.

We can directly write an implementation for a method by using lambda expressions. In this case, the compiler doesn't create a specific class file for these expressions; it executes lambda expressions as a function. We can also manipulate collections such as performing iteration, extracting and filtering data, etc.