Top Description Methods
io.vavr

public Interface CheckedConsumer<T>

Additional top-level class in compilation unit: CheckedConsumerModule.

Annotations
@FunctionalInterface
Type Parameters
<T>
the value type supplied to this consumer.
Imports
java.util.Objects, java.util.function.Consumer

A consumer that may throw, equivalent to java.util.function.Consumer.

Method Summary

Modifier and TypeMethod and Description
public void
accept(T
a value of type T
t
)

Performs side-effects.

public default CheckedConsumer<T>

Returns:

a new CheckedConsumer that chains this and after
andThen
(CheckedConsumer<? super T>
the action that will be executed after this action
after
)

Returns a chained CheckedConsumer that first executes this.accept(t) and then after.accept(t), for a given t of type T.

public static <
type of values that are accepted by the consumer
T
>
CheckedConsumer<T>

Returns:

a new CheckedConsumer
of
(CheckedConsumer<T>
(typically) a method reference, e.g. Type::method
methodReference
)

Creates a CheckedConsumer.

public default Consumer<T>

Returns:

a new Consumer that throws a Throwable.
unchecked
()

Returns an unchecked Consumer that will sneaky throw if an exceptions occurs when accepting a value.

Method Detail

acceptback to summary
public void accept(T t) throws Throwable

Performs side-effects.

Parameters
t:T

a value of type T

Exceptions
Throwable:
if an error occurs
andThenback to summary
public default CheckedConsumer<T> andThen(CheckedConsumer<? super T> after)

Returns a chained CheckedConsumer that first executes this.accept(t) and then after.accept(t), for a given t of type T.

Parameters
after:CheckedConsumer<? super T>

the action that will be executed after this action

Returns:CheckedConsumer<T>

a new CheckedConsumer that chains this and after

Exceptions
NullPointerException:
if after is null
ofback to summary
public static <T> CheckedConsumer<T> of(CheckedConsumer<T> methodReference)

Creates a CheckedConsumer.

final CheckedConsumer<Value> checkedConsumer = CheckedConsumer.of(Value::stdout);
final Consumer<Value> consumer = checkedConsumer.unchecked();

// prints "Hi" on the console
consumer.accept(CharSeq.of("Hi!"));

// throws
consumer.accept(null);
Parameters
<T>
type of values that are accepted by the consumer
methodReference:CheckedConsumer<T>

(typically) a method reference, e.g. Type::method

Returns:CheckedConsumer<T>

a new CheckedConsumer

See Also
CheckedFunction1#of(CheckedFunction1)
uncheckedback to summary
public default Consumer<T> unchecked()

Returns an unchecked Consumer that will sneaky throw if an exceptions occurs when accepting a value.

Returns:Consumer<T>

a new Consumer that throws a Throwable.