Class TransformingComparator<I,O> 
java.lang.Object
org.apache.commons.collections4.comparators.TransformingComparator<I,O> 
- Type Parameters:
- I- the type of the input to the function
- O- the type of the result of the function
- All Implemented Interfaces:
- Serializable,- Comparator<I>
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.
- Since:
- 2.1
- See Also:
- 
Constructor SummaryConstructorsConstructorDescriptionTransformingComparator(Transformer<? super I, ? extends O> transformer) Constructs an instance with the given Transformer and aComparableComparator.TransformingComparator(Transformer<? super I, ? extends O> transformer, Comparator<O> decorated) Constructs an instance with the given Transformer and Comparator.
- 
Method SummaryModifier and TypeMethodDescriptionintReturns the result of comparing the values from the transform operation.booleanReturnstrueiff that Object is aComparatorwhose ordering is known to be equivalent to mine.inthashCode()Implement a hash code for this comparator that is consistent withequals.Methods inherited from class java.lang.Objectclone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Comparatorreversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
- 
Constructor Details- 
TransformingComparatorConstructs an instance with the given Transformer and aComparableComparator.- Parameters:
- transformer- what will transform the arguments to- compare
 
- 
TransformingComparatorpublic TransformingComparator(Transformer<? super I, ? extends O> transformer, Comparator<O> decorated) Constructs an instance with the given Transformer and Comparator.- Parameters:
- transformer- what will transform the arguments to- compare
- decorated- the decorated Comparator
 
 
- 
- 
Method Details- 
compareReturns the result of comparing the values from the transform operation.- Specified by:
- comparein interface- Comparator<I>
- Parameters:
- obj1- the first object to transform then compare
- obj2- the second object to transform then compare
- Returns:
- negative if obj1 is less, positive if greater, zero if equal
 
- 
equalsReturnstrueiff that Object is aComparatorwhose ordering is known to be equivalent to mine.This implementation returns trueiff<em>that</em>is aTransformingComparatorwhose attributes are equal to mine.- Specified by:
- equalsin interface- Comparator<I>
- Overrides:
- equalsin class- Object
- Parameters:
- object- the object to compare to
- Returns:
- true if equal
 
- 
hashCode
 
-