Consumer that allows invocation of code that throws a checked
exception.
| Modifier and Type | Method and Description |
|---|---|
| public default void | accept(T
the input argument t)Implements java. Consumer#accept(Object) that wraps any thrown checked
exceptions (by default in a RuntimeException).
|
| public default void | accept(T t, BiFunction<String, Exception, RuntimeException>
BiFunction that wraps the given message
and checked exception into a runtime exceptionPerforms this operation on the given argument, wrapping any thrown
checked exceptions using the given |
| public void | acceptWithException(T
the input argument t)Performs this operation on the given argument, possibly throwing a checked exception. |
| public static < the type of the input to the operation T> ThrowingConsumer | Returns: a newThrowingConsumer instancethe source consumer consumer)Lambda friendly convenience method that can be used to create a
|
| public static < the type of the input to the operation T> ThrowingConsumer | Returns: a newThrowingConsumer instancethe source consumer consumer, BiFunction<String, Exception, RuntimeException> the exception wrapper to use exceptionWrapper)Lambda friendly convenience method that can be used to create a
|
| public default ThrowingConsumer | Returns: the replacementThrowingConsumer instanceBiFunction that wraps the given message
and checked exception into a runtime exceptionReturn a new |
| accept | back to summary |
|---|---|
| public default void accept(T t) Implements java. Default
| |
| accept | back to summary |
|---|---|
| public default void accept(T t, BiFunction<String, Exception, RuntimeException> exceptionWrapper) Performs this operation on the given argument, wrapping any thrown
checked exceptions using the given
| |
| acceptWithException | back to summary |
|---|---|
| public void acceptWithException(T t) throws Exception Performs this operation on the given argument, possibly throwing a checked exception.
| |
| of | back to summary |
|---|---|
| public static <T> ThrowingConsumer Lambda friendly convenience method that can be used to create a
This method can be especially useful when working with method references.
It allows you to easily convert a method that throws a checked exception
into an instance compatible with a regular For example: list.forEach(ThrowingConsumer.of(Example::methodThatCanThrowCheckedException));
| |
| of | back to summary |
|---|---|
| public static <T> ThrowingConsumer Lambda friendly convenience method that can be used to create a
This method can be especially useful when working with method references.
It allows you to easily convert a method that throws a checked exception
into an instance compatible with a regular For example: list.forEach(ThrowingConsumer.of(Example::methodThatCanThrowCheckedException, IllegalStateException::new));
| |
| throwing | back to summary |
|---|---|
| public default ThrowingConsumer Return a new
| |