Class OrPredicate<T>
java.lang.Object
org.apache.commons.collections4.functors.OrPredicate<T>
- All Implemented Interfaces:
Serializable,PredicateDecorator<T>,Predicate<T>
Predicate implementation that returns true if either of the predicates return true.
- Since:
- 3.0
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionOrPredicate(Predicate<? super T> predicate1, Predicate<? super T> predicate2) Constructor that performs no validation. -
Method Summary
Modifier and TypeMethodDescriptionbooleanEvaluates the predicate returning true if either predicate returns true.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.
-
Constructor Details
-
OrPredicate
Constructor that performs no validation. UseorPredicateif you want that.- Parameters:
predicate1- the first predicate to check, not nullpredicate2- the second predicate to check, not null
-
-
Method Details
-
orPredicate
public static <T> Predicate<T> orPredicate(Predicate<? super T> predicate1, Predicate<? super T> predicate2) Factory to create the predicate.- Type Parameters:
T- the type that the predicate queries- Parameters:
predicate1- the first predicate to check, not nullpredicate2- the second predicate to check, not null- Returns:
- the
andpredicate - Throws:
NullPointerException- if either predicate is null
-
evaluate
Evaluates the predicate returning true if either predicate returns true. -
getPredicates
Gets the two predicates being decorated as an array.- Specified by:
getPredicatesin interfacePredicateDecorator<T>- Returns:
- the predicates
- Since:
- 3.1
-