Functional Interfaces

Functional interface are interfaces with only one abstract method in it.
@FunctionalInterface annotation is added so that we can mark an interface as functional interface.

It is not mandatory to add this annotation to our interface but it is best if we do because if some one creates a lambda expression out of the interface and later some one adds method to that interface then those lambda expression will stop working.

@FunctionalInterface
public interface MathDemo {
	public int add(int x,int y);
}

Some of the functional interfaces provided by java 8 so that we don’t create just them manually every time we use lamdas

Leave a Reply

Your email address will not be published. Required fields are marked *