FailableConsumer
- @FunctionalInterface public interface org.apache.commons.lang3.function.FailableConsumer<T, E extends Throwable>[source]
A functional interface like
Consumerthat declares aThrowable.This is a functional interface whose functional method is
accept(Object).- Type parameters:
<T> – The type of the argument the consumer accepts.
<E> – The thrown exception type.
- Since:
3.11
Fields and constants
|
NOP singleton |
- static final FailableConsumer NOP[source]
NOP singleton
Methods
|
Accepts the given arguments. |
|
|
Applies the given |
|
|
Returns a composed |
|
|
Gets the NOP singleton. |
- void accept(T object) throws E[source]
Accepts the given arguments.
- Parameters:
object – The parameter for the consumable to accept
- Throws:
E – Thrown when the consumer fails.
- static <T, E extends Throwable> void accept(FailableConsumer<T, E> consumer, T object) throws E[source]
Applies the given
FailableConsumeraction to the object if the consumer is notnull. Otherwise, does nothing.- Type parameters:
<T> – the type of the argument the consumer accepts.
<E> – The thrown exception type.
- Parameters:
consumer – The consumer to consume.
object – The object to be consumed.
- Throws:
E – Thrown when the consumer fails.
- Since:
3.21.0
- default FailableConsumer<T, E> andThen(FailableConsumer<? super T, E> after)[source]
Returns a composed
ConsumerlikeConsumer.andThen(Consumer).- Parameters:
after – The operation to perform after this operation
- Returns:
A composed
ConsumerlikeConsumer.andThen(Consumer).- Throws:
NullPointerException– Thrown whenafteris null.
- static <T, E extends Throwable> FailableConsumer<T, E> nop()[source]
Gets the NOP singleton.
- Type parameters:
<T> – The type of the argument the consumer accepts.
<E> – The thrown exception type.
- Returns:
The NOP singleton.