java.util.function.Predicate<T>@FunctionalInterface
public interface ThrowingPredicate<T>
extends java.util.function.Predicate<T>
boolean-valued function) of one argument, possibly throwing an exception.| Modifier and Type | Method | Description |
|---|---|---|
default java.util.function.Predicate<T> |
fallbackTo(java.util.function.Predicate<T> fallback) |
Returns a
Predicate evaluating the given predicate on the argument if this predicate throws an exception. |
default java.util.function.Predicate<T> |
fallbackTo(java.util.function.Predicate<T> fallback,
java.util.function.Consumer<java.lang.Exception> exceptionConsumer) |
Returns a
Predicate evaluating the given predicate on the argument if this predicate throws an exception. |
default java.util.function.Predicate<T> |
orReturn(boolean value) |
Returns a
Predicate returning the given value if this predicate throws an exception. |
default java.util.function.Predicate<T> |
orReturn(boolean value,
java.util.function.Consumer<java.lang.Exception> exceptionConsumer) |
Returns a
Predicate returning the given value if this predicate throws an exception. |
default ThrowingPredicate<T> |
orThrow(java.lang.Class<? extends java.lang.RuntimeException> exceptionClass) |
Returns a
ThrowingPredicate throwing an exception of the given type if this predicate throws an exception. |
default ThrowingPredicate<T> |
orThrow(java.lang.Class<? extends java.lang.RuntimeException> exceptionClass,
java.lang.String message) |
Returns a
ThrowingPredicate throwing an exception of the given type if this predicate throws an exception. |
default ThrowingPredicate<T> |
orTryWith(ThrowingPredicate<? super T> other) |
Returns a
ThrowingPredicate evaluating the given predicate on the argument if this predicate throws an exception. |
default ThrowingPredicate<T> |
orTryWith(ThrowingPredicate<? super T> other,
java.util.function.Consumer<java.lang.Exception> exceptionConsumer) |
Returns a
ThrowingPredicate evaluating the given predicate on the argument if this predicate throws an exception. |
default boolean |
test(T argument) |
Evaluates this predicate on the given argument.
|
boolean |
testThrowing(T argument) |
Evaluates this predicate on the given argument.
|
default boolean test(T argument)
UncheckedException.test in interface java.util.function.Predicate<T>boolean testThrowing(T argument) throws java.lang.Exception
java.lang.Exceptiondefault java.util.function.Predicate<T> fallbackTo(java.util.function.Predicate<T> fallback)
Predicate evaluating the given predicate on the argument if this predicate throws an exception.java.lang.IllegalArgumentException - if fallback is nulldefault java.util.function.Predicate<T> fallbackTo(java.util.function.Predicate<T> fallback, java.util.function.Consumer<java.lang.Exception> exceptionConsumer)
Predicate evaluating the given predicate on the argument if this predicate throws an exception.java.lang.IllegalArgumentException - if fallback is nulldefault java.util.function.Predicate<T> orReturn(boolean value)
Predicate returning the given value if this predicate throws an exception.default java.util.function.Predicate<T> orReturn(boolean value, java.util.function.Consumer<java.lang.Exception> exceptionConsumer)
Predicate returning the given value if this predicate throws an exception.default ThrowingPredicate<T> orThrow(java.lang.Class<? extends java.lang.RuntimeException> exceptionClass)
ThrowingPredicate throwing an exception of the given type if this predicate throws an exception.
The original exception thrown by this predicate 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 ThrowingPredicate<T> orThrow(java.lang.Class<? extends java.lang.RuntimeException> exceptionClass, java.lang.String message)
ThrowingPredicate throwing an exception of the given type if this predicate throws an exception.
The original exception thrown by this predicate 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 ThrowingPredicate<T> orTryWith(ThrowingPredicate<? super T> other)
ThrowingPredicate evaluating the given predicate on the argument if this predicate throws an exception.java.lang.IllegalArgumentException - if other is nulldefault ThrowingPredicate<T> orTryWith(ThrowingPredicate<? super T> other, java.util.function.Consumer<java.lang.Exception> exceptionConsumer)
ThrowingPredicate evaluating the given predicate on the argument if this predicate throws an exception.java.lang.IllegalArgumentException - if other is null