public final class OrPredicate<T> extends Object implements PredicateDecorator<T>, Serializable
Constructor and Description |
---|
OrPredicate(Predicate<? super T> predicate1,
Predicate<? super T> predicate2)
Constructor that performs no validation.
|
Modifier and Type | Method and Description |
---|---|
boolean |
evaluate(T object)
Evaluates the predicate returning true if either predicate returns true.
|
Predicate<? super T>[] |
getPredicates()
Gets the two predicates being decorated as an array.
|
static <T> Predicate<T> |
orPredicate(Predicate<? super T> predicate1,
Predicate<? super T> predicate2)
Factory to create the predicate.
|
public OrPredicate(Predicate<? super T> predicate1, Predicate<? super T> predicate2)
orPredicate
if you want that.predicate1
- the first predicate to check, not nullpredicate2
- the second predicate to check, not nullpublic static <T> Predicate<T> orPredicate(Predicate<? super T> predicate1, Predicate<? super T> predicate2)
T
- the type that the predicate queriespredicate1
- the first predicate to check, not nullpredicate2
- the second predicate to check, not nulland
predicateNullPointerException
- if either predicate is nullpublic boolean evaluate(T object)
public Predicate<? super T>[] getPredicates()
getPredicates
in interface PredicateDecorator<T>
Copyright © 2001–2019 The Apache Software Foundation. All rights reserved.