java.util.function.Consumer<T>@FunctionalInterface
public interface ThrowingConsumer<T>
extends java.util.function.Consumer<T>
| Modifier and Type | Method | Description |
|---|---|---|
default void |
accept(T argument) |
Performs this operation on the given argument.
|
void |
acceptThrowing(T argument) |
Performs this operation on the given argument.
|
default java.util.function.Consumer<T> |
fallbackTo(java.util.function.Consumer<T> fallback) |
Returns a
Consumer performing the given operation on the argument if this operation throws an exception. |
default java.util.function.Consumer<T> |
fallbackTo(java.util.function.Consumer<T> fallback,
java.util.function.Consumer<java.lang.Exception> exceptionConsumer) |
Returns a
Consumer performing the given operation on the argument if this operation throws an exception. |
default ThrowingConsumer<T> |
orThrow(java.lang.Class<? extends java.lang.RuntimeException> exceptionClass) |
Returns a
ThrowingConsumer throwing an exception of the given type if this operation throws an exception. |
default ThrowingConsumer<T> |
orThrow(java.lang.Class<? extends java.lang.RuntimeException> exceptionClass,
java.lang.String message) |
Returns a
ThrowingConsumer throwing an exception of the given type if this operation throws an exception. |
default ThrowingConsumer<T> |
orTryWith(ThrowingConsumer<? super T> other) |
Returns a
ThrowingConsumer performing the given operation on the argument if this operation throws an exception. |
default ThrowingConsumer<T> |
orTryWith(ThrowingConsumer<? super T> other,
java.util.function.Consumer<java.lang.Exception> exceptionConsumer) |
Returns a
ThrowingConsumer performing the given operation on the argument if this operation throws an exception. |
default void accept(T argument)
UncheckedException.accept in interface java.util.function.Consumer<T>void acceptThrowing(T argument) throws java.lang.Exception
java.lang.Exceptiondefault java.util.function.Consumer<T> fallbackTo(java.util.function.Consumer<T> fallback)
Consumer performing the given operation on the argument if this operation throws an exception.java.lang.IllegalArgumentException - if fallback is nulldefault java.util.function.Consumer<T> fallbackTo(java.util.function.Consumer<T> fallback, java.util.function.Consumer<java.lang.Exception> exceptionConsumer)
Consumer performing the given operation on the argument if this operation throws an exception.java.lang.IllegalArgumentException - if fallback is nulldefault ThrowingConsumer<T> orThrow(java.lang.Class<? extends java.lang.RuntimeException> exceptionClass)
ThrowingConsumer throwing an exception of the given type if this operation throws an exception.
The original exception thrown by this operation is the cause of the thrown exception.
The exception class must have a constructor accepting a single Throwable as an argument.
java.lang.IllegalArgumentException - if exceptionClass is nulldefault ThrowingConsumer<T> orThrow(java.lang.Class<? extends java.lang.RuntimeException> exceptionClass, java.lang.String message)
ThrowingConsumer throwing an exception of the given type if this operation throws an exception.
The original exception thrown by this operation is the cause of the thrown exception.
The exception class must have a constructor accepting String and Throwable as arguments.
java.lang.IllegalArgumentException - if exceptionClass is nulldefault ThrowingConsumer<T> orTryWith(ThrowingConsumer<? super T> other)
ThrowingConsumer performing the given operation on the argument if this operation throws an exception.java.lang.IllegalArgumentException - if other is nulldefault ThrowingConsumer<T> orTryWith(ThrowingConsumer<? super T> other, java.util.function.Consumer<java.lang.Exception> exceptionConsumer)
ThrowingConsumer performing the given operation on the argument if this operation throws an exception.java.lang.IllegalArgumentException - if other is null