Package org.pipecraft.infra.concurrent
Interface FailableInterruptibleConsumer<T,E extends Exception>
-
- 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 FailableInterruptibleConsumer<T,E extends Exception>
An interreuptible consumer that may also 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 FailableInterruptibleConsumer<T,E>andThen(FailableInterruptibleConsumer<? super T,? extends E> after)Similar to andThen method ofConsumerstatic <T,E extends Exception>
FailableInterruptibleConsumer<T,E>fromConsumer(Consumer<T> consumer)Utility method for wrapping a consumer with a failable consumer
-
-
-
Method Detail
-
accept
void accept(T t) throws E extends Exception, InterruptedException
Performs this operation on the given argument.- Parameters:
t- the input argument- Throws:
E extends ExceptionInterruptedException
-
andThen
default FailableInterruptibleConsumer<T,E> andThen(FailableInterruptibleConsumer<? super T,? extends E> after)
Similar to andThen method ofConsumer
-
fromConsumer
static <T,E extends Exception> FailableInterruptibleConsumer<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)
-
-