Module net.luis.utils
Interface ThrowableBiConsumer<T,U,X extends Throwable>
- Type Parameters:
T
- The first argument typeU
- The second argument typeX
- The exception that can be thrown
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Functional interface that takes two arguments and consumes them.
The
The class is equivalent to
The
FunctionalInterface
method is accept(Object, Object)
.The class is equivalent to
BiConsumer
, but the functional method can throw a checked exception.-
Method Summary
Modifier and TypeMethodDescriptionvoid
Functional method that takes two arguments and consumes them.default @NotNull ThrowableBiConsumer
<T, U, X> andThen
(@NotNull ThrowableBiConsumer<? super T, ? super U, X> after) Returns a composed consumer of same type that performs,
in sequence, this operation followed by theafter
operation.static <T,
U> @NotNull BiConsumer <T, U> caught
(@NotNull ThrowableBiConsumer<T, U, ? extends Throwable> consumer) Converts a throwable bi-consumer into a bi-consumer that throws a runtime exception when an exception is thrown.
-
Method Details
-
caught
@NotNull static <T,U> @NotNull BiConsumer<T,U> caught(@NotNull @NotNull ThrowableBiConsumer<T, U, ? extends Throwable> consumer) Converts a throwable bi-consumer into a bi-consumer that throws a runtime exception when an exception is thrown.- Type Parameters:
T
- The first argument typeU
- The second argument type- Parameters:
consumer
- The throwable bi-consumer- Returns:
- A caught bi-consumer
- Throws:
NullPointerException
- If the throwable bi-consumer is null
-
accept
Functional method that takes two arguments and consumes them.- Parameters:
t
- The first argumentu
- The second argument- Throws:
X
- The exception that can be thrown
-
andThen
@NotNull default @NotNull ThrowableBiConsumer<T,U, andThenX> (@NotNull @NotNull ThrowableBiConsumer<? super T, ? super U, X> after) Returns a composed consumer of same type that performs,
in sequence, this operation followed by theafter
operation.- Parameters:
after
- The operation to perform after this operation- Returns:
- The composed throwable consumer
- Throws:
NullPointerException
- If the after operation is null
-