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

Consumer

declaration
@FunctionalInterface
public interface Consumer<T>

T → void side-effecting action: forEach bodies, callbacks, builders. Chain with andThen.

Key methods

void accept(T t)The action.
default Consumer<T> andThen(Consumer<T> after)Sequential composition.