T
- the type of the first thingU
- The type of the second thing@FunctionalInterface
public interface BiAction<T,U>
This type serves the same purpose as the JDK's BiConsumer
, but allows throwing checked exceptions.
It contains methods for bridging to and from the JDK type.
Modifier and Type | Method and Description |
---|---|
void |
execute(T t,
U u)
Executes the action against the given thing.
|
static <T,U> BiAction<T,U> |
from(java.util.function.BiConsumer<T,U> consumer)
Creates an bi-action from a JDK bi-consumer.
|
static <T,U> BiAction<T,U> |
noop()
Returns a bi-action that does precisely nothing.
|
default java.util.function.BiConsumer<T,U> |
toBiConsumer()
Creates a JDK
BiConsumer from this action. |
void execute(T t, U u) throws java.lang.Exception
t
- the first thing to input to the actionu
- the second thing to input to the actionjava.lang.Exception
- if anything goes wrongstatic <T,U> BiAction<T,U> noop()
T
- the type of the first thingU
- The type of the second thingdefault java.util.function.BiConsumer<T,U> toBiConsumer()
BiConsumer
from this action.
Any exceptions thrown by this
action will be unchecked via Exceptions.uncheck(Throwable)
and rethrown.
static <T,U> BiAction<T,U> from(java.util.function.BiConsumer<T,U> consumer)
T
- the type of the first object this action acceptsU
- the type of the second object this action acceptsconsumer
- the JDK consumer