Interface CheckedPredicate<T>
- Type Parameters:
T- the type of the input to the predicate
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
A Predicate which may throw.
-
Method Summary
Modifier and TypeMethodDescriptiondefault CheckedPredicate<T> negate()Negates this predicate.static <T> CheckedPredicate<T> of(CheckedPredicate<T> methodReference) Creates aCheckedPredicate.booleanEvaluates this predicate on the given argument.Returns an uncheckedPredicatethat will sneaky throw if an exceptions occurs when testing a value.
-
Method Details
-
of
Creates aCheckedPredicate.final CheckedPredicate<Boolean> checkedPredicate = CheckedPredicate.of(Boolean::booleanValue); final Predicate<Boolean> predicate = checkedPredicate.unchecked(); // = true predicate.test(Boolean.TRUE); // throws predicate.test(null);- Type Parameters:
T- type of values that are tested by the predicate- Parameters:
methodReference- (typically) a method reference, e.g.Type::method- Returns:
- a new
CheckedPredicate - See Also:
-
test
-
negate
-
unchecked
-