T
- The type of the first input to the operation.U
- The type of the second input to the operation.V
- The type of the third input to the operation.E
- The type of the exception that can be thrown.@FunctionalInterface public interface ThrowingTriConsumer<T,U,V,E extends Exception> extends TriConsumer<T,U,V>
TriConsumer
is
expected to operate via side-effects.
The ThrowingBiConsumer
distinguishes itself from BiConsumer
by
allowing the functional interface to throw an Exception
. This can be
used to allow lambda expressions to propagate checked exceptions up the
expression's call stack. An example of this pattern:
TriConsumer<Integer,Integer,Integer> consumer = Throwing.<Integer,Integer,Integer>rethrow((i, j, k) -> {
if (i == 0)
throw new IllegalArgumentException("i=" + i);
});
for (int i = 3; i >= 0; --i)
consumer.accept(i, -i, i);
Throwing
Modifier and Type | Method and Description |
---|---|
default void |
accept(T t,
U u,
V v)
Performs this operation on the given arguments.
|
void |
acceptThrows(T t,
U u,
V v)
Performs this operation on the given argument, allowing an exception to be
thrown.
|
andThen
default void accept(T t, U u, V v)
TriConsumer
accept
in interface TriConsumer<T,U,V>
t
- The first input argument.u
- The second input argument.v
- The third input argument.Copyright © 2020 LibJ. All rights reserved.