Interface FailableConsumer<T, E extends Throwable>
- Type Parameters:
T- The type of the argument the consumer accepts.E- The thrown exception type.
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
A functional interface like
Consumer that declares a Throwable.
This is a functional interface whose functional method is accept(Object).
- Since:
- 3.11
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic <T, E extends Throwable>
voidaccept(FailableConsumer<T, E> consumer, T object) Applies the givenFailableConsumeraction to the object if the consumer is notnull.voidAccepts the given arguments.default FailableConsumer<T, E> andThen(FailableConsumer<? super T, E> after) Returns a composedConsumerlikeConsumer.andThen(Consumer).static <T, E extends Throwable>
FailableConsumer<T, E> nop()Gets the NOP singleton.
-
Field Details
-
NOP
NOP singleton
-
-
Method Details
-
accept
Applies the givenFailableConsumeraction 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
-
nop
Gets the NOP singleton.- Type Parameters:
T- The type of the argument the consumer accepts.E- The thrown exception type.- Returns:
- The NOP singleton.
-
accept
-
andThen
Returns a composedConsumerlikeConsumer.andThen(Consumer).- Parameters:
after- The operation to perform after this operation- Returns:
- A composed
ConsumerlikeConsumer.andThen(Consumer). - Throws:
NullPointerException- Thrown whenafteris null.
-