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

public final Class AndPredicate<T>

extends Object
implements PredicateDecorator<T>, Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable, org.apache.commons.collections4.functors.PredicateDecorator, org.apache.commons.collections4.Predicate
Imports
java.io.Serializable, org.apache.commons.collections4.Predicate

Predicate implementation that returns true if both the predicates return true.
Since
3.0

Field Summary

Modifier and TypeField and Description
private final Predicate<? super T>
iPredicate1

The array of predicates to call

private final Predicate<? super T>
iPredicate2

The array of predicates to call

private static final long
serialVersionUID

Serial version UID

Constructor Summary

AccessConstructor and Description
public
AndPredicate(final Predicate<? super T>
the first predicate to check, not null
predicate1
,
final Predicate<? super T>
the second predicate to check, not null
predicate2
)

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 and predicate
andPredicate
(final Predicate<? super T>
the first predicate to check, not null
predicate1
,
final Predicate<? super T>
the second predicate to check, not null
predicate2
)

Factory to create the predicate.

public boolean

Returns:

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

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

Evaluates the predicate returning true if both predicates return true.
public Predicate<? super T>[]

Returns:

the predicates
getPredicates
()

Implements org.apache.commons.collections4.functors.PredicateDecorator.getPredicates.

Gets the two predicates being decorated as an array.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

iPredicate1back to summary
private final Predicate<? super T> iPredicate1

The array of predicates to call

iPredicate2back to summary
private final Predicate<? super T> iPredicate2

The array of predicates to call

serialVersionUIDback to summary
private static final long serialVersionUID

Serial version UID

Constructor Detail

AndPredicateback to summary
public AndPredicate(final Predicate<? super T> predicate1, final Predicate<? super T> predicate2)

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

Parameters
predicate1:Predicate<? super T>

the first predicate to check, not null

predicate2:Predicate<? super T>

the second predicate to check, not null

Method Detail

andPredicateback to summary
public static <T> Predicate<T> andPredicate(final Predicate<? super T> predicate1, final Predicate<? super T> predicate2)

Factory to create the predicate.

Parameters
<T>
the type that the predicate queries
predicate1:Predicate<? super T>

the first predicate to check, not null

predicate2:Predicate<? super T>

the second predicate to check, not null

Returns:Predicate<T>

the and predicate

Exceptions
NullPointerException:
if either predicate is null
evaluateback to summary
public boolean evaluate(final T object)

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

Evaluates the predicate returning true if both predicates return true.

Parameters
object:T

the input object

Returns:boolean

true if both decorated predicates return true

Annotations
@Override
getPredicatesback to summary
public Predicate<? super T>[] getPredicates()

Implements org.apache.commons.collections4.functors.PredicateDecorator.getPredicates.

Gets the two predicates being decorated as an array.

Returns:Predicate<? super T>[]

the predicates

Annotations
@Override
@SuppressWarnings:unchecked
Since
3.1