public final class OnePredicate<T> extends AbstractQuantifierPredicate<T>
NOTE: In versions prior to 3.2 an array size of zero or one threw an exception.
iPredicates| Constructor and Description |
|---|
OnePredicate(Predicate<? super T>... predicates)
Constructor that performs no validation.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
evaluate(T object)
Evaluates the predicate returning true if only one decorated predicate
returns true.
|
static <T> Predicate<T> |
onePredicate(Collection<? extends Predicate<? super T>> predicates)
Factory to create the predicate.
|
static <T> Predicate<T> |
onePredicate(Predicate<? super T>... predicates)
Factory to create the predicate.
|
getPredicatespublic static <T> Predicate<T> onePredicate(Predicate<? super T>... predicates)
If the array is size zero, the predicate always returns false. If the array is size one, then that predicate is returned.
T - the type that the predicate queriespredicates - the predicates to check, cloned, not nullany predicateNullPointerException - if the predicates array is nullNullPointerException - if any predicate in the array is nullpublic static <T> Predicate<T> onePredicate(Collection<? extends Predicate<? super T>> predicates)
T - the type that the predicate queriespredicates - the predicates to check, cloned, not nullone predicateNullPointerException - if the predicates array is nullNullPointerException - if any predicate in the array is nullpublic boolean evaluate(T object)
object - the input objectCopyright © 2001–2015 The Apache Software Foundation. All rights reserved.