org.apache.commons.collections.functors

Class IdentityPredicate

Implemented Interfaces:
Predicate, Serializable

public final class IdentityPredicate
extends java.lang.Object
implements Predicate, Serializable

Predicate implementation that returns true if the input is the same object as the one stored in this predicate.

Version:
$Revision: 1.5 $ $Date: 2004/05/16 11:16:01 $

Author:
Stephen Colebourne

Since:
Commons Collections 3.0

Constructor Summary

IdentityPredicate(Object object)
Constructor that performs no validation.

Method Summary

boolean
evaluate(Object object)
Evaluates the predicate returning true if the input object is identical to the stored object.
static Predicate
getInstance(Object object)
Factory to create the identity predicate.
Object
getValue()
Gets the value.

Constructor Details

IdentityPredicate

public IdentityPredicate(Object object)
Constructor that performs no validation. Use getInstance if you want that.

Parameters:
object - the object to compare to

Method Details

evaluate

public boolean evaluate(Object object)
Evaluates the predicate returning true if the input object is identical to the stored object.
Specified by:
evaluate in interface Predicate

Parameters:
object - the input object

Returns:
true if input is the same object as the stored value


getInstance

public static Predicate getInstance(Object object)
Factory to create the identity predicate.

Parameters:
object - the object to compare to

Returns:
the predicate


getValue

public Object getValue()
Gets the value.

Returns:
the value

Since:
Commons Collections 3.1


Copyright © 2001-2005 Apache Software Foundation. All Rights Reserved.