T
- the type of the input to the predicate@FunctionalInterface public interface CheckedPredicate<T>
Modifier and Type | Method and Description |
---|---|
default CheckedPredicate<T> |
negate()
Negates this predicate.
|
static <T> CheckedPredicate<T> |
of(CheckedPredicate<T> methodReference)
Creates a
CheckedPredicate . |
boolean |
test(T t)
Evaluates this predicate on the given argument.
|
default Predicate<T> |
unchecked()
Returns an unchecked
Predicate that will sneaky throw if an exceptions occurs when testing a value. |
static <T> CheckedPredicate<T> of(CheckedPredicate<T> methodReference)
CheckedPredicate
.
final CheckedPredicate<Boolean> checkedPredicate = CheckedPredicate.of(Boolean::booleanValue);
final Predicate<Boolean> predicate = checkedPredicate.unchecked();
// = true
predicate.test(Boolean.TRUE);
// throws
predicate.test(null);
T
- type of values that are tested by the predicatemethodReference
- (typically) a method reference, e.g. Type::method
CheckedPredicate
CheckedFunction1.of(CheckedFunction1)
boolean test(T t) throws Throwable
t
- the input argumenttrue
if the input argument matches the predicate, otherwise false
Throwable
- if an error occursdefault CheckedPredicate<T> negate()
Copyright © 2021. All Rights Reserved.