Functional Interface and Lambda Expression
Functional Interface and Lambda Expression Functional Interfaces A functional interface is an interface that contains only one abstract method. It can have one or more default or static method but abstract method should be only one. Runnable , Callable, ActionListener , Comparable are some of the examples of functional interfaces as it contains only one abstract method. Let’s see some functional Interface implementation example: Example 1: public interface SimpleInterface { public void abstractMethod(); } It’s a functional Interface as it only contains a single abstract method. Example 2: public interface ComplexInterface { public void abstractMethod(); public default void defaultMethod(){ System.out.println(“Default method”); } public static void staticMethod(){ System.out.println(“Static me...