@FunctionalInterface public interface ThrowingConsumer<T,E extends Exception>
Consumer<T>
that can throw an exception.Modifier and Type | Interface and Description |
---|---|
static class |
ThrowingConsumer.TunneledException
An exception used to tunnel checked exceptions through a non-throwing interface.
|
Modifier and Type | Method and Description |
---|---|
void |
accept(T t) |
static <T,E extends Exception> |
wrapAsUnchecked(java.util.function.Consumer<java.util.function.Consumer<T>> consumerConsumer,
ThrowingConsumer<T,E> consumer)
Helper to package a
ThrowingConsumer as a Consumer and apply it on action
expecting the latter. |
static <T,E extends Exception> void wrapAsUnchecked(java.util.function.Consumer<java.util.function.Consumer<T>> consumerConsumer, ThrowingConsumer<T,E> consumer) throws E extends Exception
ThrowingConsumer
as a Consumer
and apply it on action
expecting the latter. Checked exceptions thrown by the former are tunneled inside unchecked
exceptions and re-raised.E extends Exception