Package org.pipecraft.infra.concurrent
Interface FailableConsumer<T,E extends Exception>
-
- Type Parameters:
T- The type of the data being consumedE- The exception type
- 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 FailableConsumer<T,E extends Exception>
A consumer that may fail with a checked exception during the execution of the accept(..) method.- Author:
- Eyal Schneider
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voidaccept(T t)Performs this operation on the given argument.default FailableConsumer<T,E>andThen(FailableConsumer<? super T,? extends E> after)Similar to andThen method ofConsumerstatic <T,E extends Exception>
FailableConsumer<T,E>fromConsumer(Consumer<T> consumer)Utility method for wrapping a consumer with a failable consumer
-
-
-
Method Detail
-
andThen
default FailableConsumer<T,E> andThen(FailableConsumer<? super T,? extends E> after)
Similar to andThen method ofConsumer
-
fromConsumer
static <T,E extends Exception> FailableConsumer<T,E> fromConsumer(Consumer<T> consumer)
Utility method for wrapping a consumer with a failable consumer- Parameters:
consumer- The consumer to wrap- Returns:
- The failable consumer (which effectively never throws checked exceptions)
-
-