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

public final Class AnyPredicate<T>

extends AbstractQuantifierPredicate<T>
Class Inheritance
Imports
java.util.Collection, org.apache.commons.collections4.Predicate

Predicate implementation that returns true if any of the predicates return true. If the array of predicates is empty, then this predicate returns false.

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
AnyPredicate(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 any predicate
anyPredicate
(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
anyPredicate
(final Collection<? extends Predicate<? super T>>
the predicates to check, cloned, not null
predicates
)

Factory to create the predicate.

public boolean

Returns:

true if any decorated predicate return true
evaluate
(final T
the input object
object
)

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

Evaluates the predicate returning true if any predicate returns 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

AnyPredicateback to summary
public AnyPredicate(final Predicate<? super T>... predicates)

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

Parameters
predicates:Predicate<? super T>[]

the predicates to check, not cloned, not null

Method Detail

anyPredicateback to summary
public static <T> Predicate<T> anyPredicate(final Predicate<? super T>... predicates)

Factory to create the predicate.

If the array is size zero, the predicate always returns false. 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 any predicate

Annotations
@SuppressWarnings:unchecked
Exceptions
NullPointerException:
  • if the predicates array is null
  • if any predicate in the array is null
anyPredicateback to summary
public static <T> Predicate<T> anyPredicate(final Collection<? extends Predicate<? super T>> predicates)

Factory to create the predicate.

If the collection is size zero, the predicate always returns false. 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

Annotations
@SuppressWarnings:unchecked
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 any predicate returns true.

Parameters
object:T

the input object

Returns:boolean

true if any decorated predicate return true

Annotations
@Override