FailableConsumer¶
- @FunctionalInterface public abstract 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).- Parameters:
<T> – The type of the argument the consumer accepts.
<E> – The thrown exception type.
- Since:
3.11
Fields and constants¶
NOP singleton |
- @SuppressWarnings({"rawtypes"}) public static final FailableConsumer NOP[source]¶
NOP singleton
Methods¶
Accepts the given arguments. |
|
Applies the given |
|
Returns a composed |
|
Gets the NOP singleton. |
- public abstract 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.
- public 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.- Parameters:
consumer – The consumer to consume.
object – The object to be consumed.
- Type parameters:
<T> – the type of the argument the consumer accepts.
<E> – The thrown exception type.
- Throws:
E – Thrown when the consumer fails.
- Since:
3.21.0
- public 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:
java.lang.NullPointerException – Thrown when
afteris null.
- @SuppressWarnings({"unchecked"}) public 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.