A core concept introduced in Java 8 is the functional interface (functional Interfaces).
By adding an abstract method to the interface, these methods can be run directly from the interface.
If an interface defines a unique abstract method , then this interface becomes a functional interface .
At the same time, a new annotation was introduced:@FunctionalInterface.
Can put him in front of an interface, indicating that this interface is a functional interface.
This annotation is not necessary , as long as the interface contains only one method interface, the virtual opportunity is automatically judged, but it is best to use annotations @FunctionalInterface on the interface to declare.
A @FunctionalInterface interface is added to the interface, only one abstract method is allowed, or the compiler will error .
Java.lang.Runnable is a function-type interface.
Package Java.lang; @FunctionalInterface Public Interface Runnable { void run ();}
Quoted from: Https://www.ibm.com/developerworks/cn/java/j-lo-jdk8newfeature/
Java 8 new features-functional interfaces