public class TransformingComparator<I,O> extends Object implements Comparator<I>, Serializable
compare method.
This class is Serializable from Commons Collections 4.0.
Transformer,
ComparableComparator,
Serialized Form| Constructor and Description |
|---|
TransformingComparator(Transformer<? super I,? extends O> transformer)
Constructs an instance with the given Transformer and a
ComparableComparator. |
TransformingComparator(Transformer<? super I,? extends O> transformer,
Comparator<O> decorated)
Constructs an instance with the given Transformer and Comparator.
|
| Modifier and Type | Method and Description |
|---|---|
int |
compare(I obj1,
I obj2)
Returns the result of comparing the values from the transform operation.
|
boolean |
equals(Object object)
Returns
true iff that Object is
is a Comparator whose ordering is known to be
equivalent to mine. |
int |
hashCode()
Implement a hash code for this comparator that is consistent with
equals. |
public TransformingComparator(Transformer<? super I,? extends O> transformer)
ComparableComparator.transformer - what will transform the arguments to comparepublic TransformingComparator(Transformer<? super I,? extends O> transformer, Comparator<O> decorated)
transformer - what will transform the arguments to comparedecorated - the decorated Comparatorpublic int compare(I obj1, I obj2)
compare in interface Comparator<I>obj1 - the first object to transform then compareobj2 - the second object to transform then comparepublic int hashCode()
equals.public boolean equals(Object object)
true iff that Object is
is a Comparator whose ordering is known to be
equivalent to mine.
This implementation returns true
iff that is a TransformingComparator
whose attributes are equal to mine.
equals in interface Comparator<I>equals in class Objectobject - the object to compare toCopyright © 2001–2013 The Apache Software Foundation. All rights reserved.