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

UnaryOperator

declaration
@FunctionalInterface
public interface UnaryOperator<T> extends Function<T, T>

T → T same-type transform — Function specialized for in-kind updates (List.replaceAll, AtomicReference.updateAndGet).

Key methods

static <T> UnaryOperator<T> identity()x → x.