|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.collections4.comparators.TransformingComparator<I,O>
public class TransformingComparator<I,O>
Decorates another Comparator with transformation behavior. That is, the
return value from the transform operation will be passed to the decorated
compare
method.
This class is Serializable from Commons Collections 4.0.
Transformer
,
ComparableComparator
,
Serialized FormConstructor Summary | |
---|---|
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. |
Method Summary | |
---|---|
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 . |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
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 ComparatorMethod Detail |
---|
public 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 compare
public int hashCode()
equals
.
hashCode
in class Object
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 to
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |