Functional Interfaces
Details about functional interfaces in Java.
What is Functional Interface in Java?
A functional interface is an interface that contains exactly one abstract method.
It plays a important role in implementing functional style programming.
Functional interface is usually marked with
@FunctionalInterface
annotation. While optional, this annotation helps the compiler verify that the interface adheres to the "single abstract method" rule.Java's
java.util.function
package provides several built-in functional interfaces.
Sample Example
Create a custom functional interface and add sample logic in the main application to use the newly created interface
Execute the program
Last updated