java.io.Serializable, java.util.Comparator<I>public class TransformingComparator<I,O>
extends java.lang.Object
implements java.util.Comparator<I>, java.io.Serializable
compare method.
This class is Serializable from Commons Collections 4.0.
Transformer,
ComparableComparator,
Serialized Form| Constructor | 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,
java.util.Comparator<O> decorated) |
Constructs an instance with the given Transformer and Comparator.
|
| Modifier and Type | Method | Description |
|---|---|---|
int |
compare(I obj1,
I obj2) |
Returns the result of comparing the values from the transform operation.
|
boolean |
equals(java.lang.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, java.util.Comparator<O> decorated)
transformer - what will transform the arguments to comparedecorated - the decorated Comparatorpublic int compare(I obj1, I obj2)
compare in interface java.util.Comparator<I>obj1 - the first object to transform then compareobj2 - the second object to transform then comparepublic int hashCode()
equals.hashCode in class java.lang.Objectpublic boolean equals(java.lang.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 java.util.Comparator<I>equals in class java.lang.Objectobject - the object to compare toCopyright © 2001-2019 - Apache Software Foundation