org.apache.commons.collections.comparators
Class TransformingComparator
java.lang.Object
org.apache.commons.collections.comparators.TransformingComparator
- Comparator
public class TransformingComparator
implements Comparator
Decorates another Comparator with transformation behavior. That is, the
return value from the transform operation will be passed to the decorated
compare
method.
$Revision: 155406 $ $Date: 2005-02-26 12:55:26 +0000 (Sat, 26 Feb 2005) $- Commons Collections 2.0 (?)
int | compare(Object obj1, Object obj2) - Returns the result of comparing the values from the transform operation.
|
decorated
protected Comparator decorated
The decorated comparator.
transformer
protected Transformer transformer
The transformer being used.
TransformingComparator
public TransformingComparator(Transformer transformer)
transformer
- what will transform the arguments to compare
TransformingComparator
public TransformingComparator(Transformer transformer,
Comparator decorated)
Constructs an instance with the given Transformer and Comparator.
transformer
- what will transform the arguments to compare
decorated
- the decorated Comparator
compare
public int compare(Object obj1,
Object obj2)
Returns the result of comparing the values from the transform operation.
obj1
- the first object to transform then compareobj2
- the second object to transform then compare
- negative if obj1 is less, positive if greater, zero if equal
Copyright © 2001-2009 Apache Software Foundation. All Rights Reserved.