Consumer functional interface in java 8

/, Java 8/Consumer functional interface in java 8

What is Consumer functional interface in Java?

Consumer represents an operation that accepts a single input argument and returns no result.

This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

methods :

Modifier and Type Method and Description
void accept(T t)

Performs this operation on the given argument.

default Consumer<T> andThen(Consumer<? super T> after)

Returns a composed Consumer that performs, in sequence, this operation followed by the after operation.

accept()

andThen()

Leave A Comment