I
- the input type to the transformerO
- the output type from the transformerpublic class TransformingComparator<I,O> extends Object implements Comparator<I>, Serializable
compare
method.
This class is Serializable from Commons Collections 4.0.
Transformer
,
ComparableComparator
,
Serialized FormConstructor 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 . |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
comparing, comparing, comparingDouble, comparingInt, comparingLong, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
public TransformingComparator(Transformer<? super I,? extends O> transformer)
ComparableComparator
.transformer
- what will transform the arguments to compare
public TransformingComparator(Transformer<? super I,? extends O> transformer, Comparator<O> decorated)
transformer
- what will transform the arguments to compare
decorated
- 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 Object
object
- the object to compare toCopyright © 2001–2018 The Apache Software Foundation. All rights reserved.