Package com.pivovarit.function
Interface ThrowingBiConsumer<T,U,E extends Exception>
- Type Parameters:
T- the type of the first argument to the operationU- the type of the second argument to the operationE- the type of the thrown checked exception
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Represents an operation that accepts two input arguments and returns no
result. This is the two-arity specialization of
ThrowingConsumer.
Unlike most other functional interfaces, ThrowingBiConsumer is expected
to operate via side effects.- Author:
- Grzegorz Piwowarek
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoiddefault ThrowingBiConsumer<T, U, E> andThenConsume(ThrowingBiConsumer<? super T, ? super U, ? extends E> after) default ThrowingBiFunction<T, U, Void, E> Returns this ThrowingBiConsumer instance as a ThrowingBiFunctionstatic <T,U> BiConsumer <T, U> sneaky(ThrowingBiConsumer<T, U, ?> consumer) Returns a new BiConsumer instance which rethrows the checked exception using the Sneaky Throws patterndefault BiConsumer<T, U> uncheck()Returns a new BiConsumer instance which wraps thrown checked exception instance into a RuntimeExceptionstatic <T,U> BiConsumer <T, U> unchecked(ThrowingBiConsumer<T, U, ?> consumer)
-
Method Details
-
accept
- Throws:
E
-
andThenConsume
default ThrowingBiConsumer<T,U, andThenConsumeE> (ThrowingBiConsumer<? super T, ? super U, ? extends E> after) -
asFunction
Returns this ThrowingBiConsumer instance as a ThrowingBiFunction- Returns:
- this action as a ThrowingBiFunction
-
unchecked
-
sneaky
Returns a new BiConsumer instance which rethrows the checked exception using the Sneaky Throws pattern- Type Parameters:
T- the type of the first argument to the operationU- the type of the second argument to the operation- Parameters:
consumer- ThrowingBiConsumer operation throwing checked exception- Returns:
- BiConsumer instance that rethrows the checked exception using the Sneaky Throws pattern
-
uncheck
Returns a new BiConsumer instance which wraps thrown checked exception instance into a RuntimeException- Returns:
- BiConsumer instance that packages checked exceptions into RuntimeException instances
-