Package io.vavr.control
Interface CheckedConsumer<T>
-
- Type Parameters:
T
- the type of the consumed argument
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface CheckedConsumer<T>
A function that consumes an argument, returns nothing and may throw anException
. Such a function is expected to perform side-effects, i.e. altering the outer world.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
accept(T t)
Consumes the given argumentt
by performing an action.default CheckedConsumer<T>
andThen(CheckedConsumer<? super T> after)
Returns a newCheckedConsumer
that first executes this operation and then the given operationafter
.
-
-
-
Method Detail
-
accept
void accept(T t) throws java.lang.Exception
Consumes the given argumentt
by performing an action.- Parameters:
t
- the input argument- Throws:
java.lang.Exception
- if an error occurs when performing the action
-
andThen
default CheckedConsumer<T> andThen(CheckedConsumer<? super T> after)
Returns a newCheckedConsumer
that first executes this operation and then the given operationafter
. If this operation throws an exceptionafter
is not executed.- Parameters:
after
- a function that consumes a given argument after this successfully did- Returns:
- a new
CheckedConsumer
that first performs this and thenafter
- Throws:
java.lang.NullPointerException
- ifafter
is null
-
-