java.util.function · java.base · since Java 1.8

Function

declaration
@FunctionalInterface
public interface Function<T, R>

T → R transformation, the most general functional shape. Composes with andThen/compose; identity() is the no-op.

Key methods

R apply(T t)The transformation.
default <V> Function<T,V> andThen(Function<R,V> after)this first, then after.
default <V> Function<V,R> compose(Function<V,T> before)before first, then this.
static <T> Function<T,T> identity()x → x (useful in toMap).