T
- The type of the first thing.U
- 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(BiConsumer<T,U> consumer)
Creates an bi-action from a JDK bi-consumer.
|
default BiConsumer<T,U> |
toBiConsumer()
Creates a JDK
BiConsumer from this action. |
void execute(T t, U u) throws Exception
t
- the first thing to input to the actionu
- the second thing to input to the actionException
- if anything goes wrongdefault 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(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