Functional Programming - Functional Interface in Java.
A functional interface is is a interface that contains only one abstract method.
The interface is so simple that java defines several standard (built-in) functional interfaces
Functional interfaces represent abstract concepts like:
A functional interface is is a interface that contains only one abstract method.
The single abstract method is called the functional method.
It may contain one or more:
The FunctionalInterface annotation is an aid to capture design intent not a requirement. Compilers may generate an error.
The single abstract method in a function interface is called the functional method.
Implementation of functional interfaces can be created with:
The predefined/standard/built-in function interface can find in the package java.util.function package
They are generic interface.
All standard interface follows the following naming convention.
interface Predicate<T> {
boolean test(T t);
}
interface Consumer<T> {
void accept(T t);
}
interface Function<T> {
R apply(T t);
}
interface UnaryOperator<T> {
T apply(T t);
}