Class NonePredicate<T>
- java.lang.Object
-
- org.apache.commons.collections4.functors.AbstractQuantifierPredicate<T>
-
- org.apache.commons.collections4.functors.NonePredicate<T>
-
- All Implemented Interfaces:
java.io.Serializable
,PredicateDecorator<T>
,Predicate<T>
public final class NonePredicate<T> extends AbstractQuantifierPredicate<T>
Predicate implementation that returns true if none of the predicates return true. If the array of predicates is empty, then this predicate returns true.NOTE: In versions prior to 3.2 an array size of zero or one threw an exception.
- Since:
- 3.0
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description NonePredicate(Predicate<? super T>... predicates)
Constructor that performs no validation.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
evaluate(T object)
Evaluates the predicate returning false if any stored predicate returns false.static <T> Predicate<T>
nonePredicate(java.util.Collection<? extends Predicate<? super T>> predicates)
Factory to create the predicate.static <T> Predicate<T>
nonePredicate(Predicate<? super T>... predicates)
Factory to create the predicate.-
Methods inherited from class org.apache.commons.collections4.functors.AbstractQuantifierPredicate
getPredicates
-
-
-
-
Method Detail
-
nonePredicate
public static <T> Predicate<T> nonePredicate(Predicate<? super T>... predicates)
Factory to create the predicate.If the array is size zero, the predicate always returns true.
- Type Parameters:
T
- the type that the predicate queries- Parameters:
predicates
- the predicates to check, cloned, not null- Returns:
- the
any
predicate - Throws:
java.lang.NullPointerException
- if the predicates array is nulljava.lang.NullPointerException
- if any predicate in the array is null
-
nonePredicate
public static <T> Predicate<T> nonePredicate(java.util.Collection<? extends Predicate<? super T>> predicates)
Factory to create the predicate.If the collection is size zero, the predicate always returns true.
- Type Parameters:
T
- the type that the predicate queries- Parameters:
predicates
- the predicates to check, cloned, not null- Returns:
- the
one
predicate - Throws:
java.lang.NullPointerException
- if the predicates array is nulljava.lang.NullPointerException
- if any predicate in the array is null
-
evaluate
public boolean evaluate(T object)
Evaluates the predicate returning false if any stored predicate returns false.- Parameters:
object
- the input object- Returns:
- true if none of decorated predicates return true
-
-