Top Description Fields Constructors Methods
org.apache.commons.collections4.functors

public final Class AllPredicate<T>

extends AbstractQuantifierPredicate<T>
Class Inheritance
Static Imports
org.apache.commons.collections4.functors.FunctorUtils.coerce, .FunctorUtils.validate, .TruePredicate.truePredicate

Predicate implementation that returns true if all 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

Field Summary

Modifier and TypeField and Description
private static final long
Inherited from org.apache.commons.collections4.functors.AbstractQuantifierPredicate:
iPredicates

Constructor Summary

AccessConstructor and Description
public
AllPredicate(final Predicate<? super T>...
the predicates to check, not cloned, not null
predicates
)

Constructor that performs no validation.

Method Summary

Modifier and TypeMethod and Description
public static <
the type that the predicate queries
T
>
Predicate<T>

Returns:

the all predicate
allPredicate
(final Predicate<? super T>...
the predicates to check, cloned, not null
predicates
)

Factory to create the predicate.

public static <
the type that the predicate queries
T
>
Predicate<T>

Returns:

the all predicate
allPredicate
(final Collection<? extends Predicate<? super T>>
the predicates to check, cloned, not null
predicates
)

Factory to create the predicate.

public boolean

Returns:

true if all decorated predicates return true
evaluate
(final T
the input object
object
)

Implements org.apache.commons.collections4.Predicate.evaluate.

Evaluates the predicate returning true if all predicates return true.
Inherited from org.apache.commons.collections4.functors.AbstractQuantifierPredicate:
getPredicates

Field Detail

serialVersionUIDback to summary
private static final long serialVersionUID

Hides org.apache.commons.collections4.functors.AbstractQuantifierPredicate.serialVersionUID.

Serial version UID

Constructor Detail

AllPredicateback to summary
public AllPredicate(final Predicate<? super T>... predicates)

Constructor that performs no validation. Use allPredicate if you want that.

Parameters
predicates:Predicate<? super T>[]

the predicates to check, not cloned, not null

Method Detail

allPredicateback to summary
public static <T> Predicate<T> allPredicate(final Predicate<? super T>... predicates)

Factory to create the predicate.

If the array is size zero, the predicate always returns true. If the array is size one, then that predicate is returned.

Parameters
<T>
the type that the predicate queries
predicates:Predicate<? super T>[]

the predicates to check, cloned, not null

Returns:Predicate<T>

the all predicate

Exceptions
NullPointerException:
  • if the predicates array is null
  • if any predicate in the array is null
allPredicateback to summary
public static <T> Predicate<T> allPredicate(final Collection<? extends Predicate<? super T>> predicates)

Factory to create the predicate.

If the collection is size zero, the predicate always returns true. If the collection is size one, then that predicate is returned.

Parameters
<T>
the type that the predicate queries
predicates:Collection<? extends Predicate<? super T>>

the predicates to check, cloned, not null

Returns:Predicate<T>

the all predicate

Exceptions
NullPointerException:
  • if the predicates array is null
  • if any predicate in the array is null
evaluateback to summary
public boolean evaluate(final T object)

Implements org.apache.commons.collections4.Predicate.evaluate.

Evaluates the predicate returning true if all predicates return true.

Parameters
object:T

the input object

Returns:boolean

true if all decorated predicates return true

Annotations
@Override