public final class Consumers extends Object
Static utility methods pertaining to Consumer
instances.
Modifier and Type | Method and Description |
---|---|
static <T,R> Consumer<T> |
compose(Function<? super T,? extends R> function,
Consumer<? super R> consumer)
The equivalent of
Function.compose(java.util.function.Function<? super V, ? extends T>) , but for Consumer . |
static <T> Consumer<T> |
doNothing()
A
Consumer which does nothing. |
static <T> Consumer<T> |
redirectable(Supplier<Consumer<T>> target)
Creates a
Consumer which delegates every call to whatever Consumer is supplied by Supplier<Consumer> target . |
public static <T> Consumer<T> doNothing()
A Consumer
which does nothing.
public static <T,R> Consumer<T> compose(Function<? super T,? extends R> function, Consumer<? super R> consumer)
The equivalent of Function.compose(java.util.function.Function<? super V, ? extends T>)
, but for Consumer
.