org.apache.commons.io.comparator
Class ReverseComparator
java.lang.Objectorg.apache.commons.io.comparator.ReverseComparator
- Comparator, Serializable
(package private) class ReverseComparator
extends java.lang.Object
implements Comparator, Serializable
Reverses the result of comparing two objects using
the delegate Comparator.
$Revision: 609243 $ $Date: 2008-01-06 00:30:42 +0000 (Sun, 06 Jan 2008) $
ReverseComparator(Comparator delegate)- Construct an instance with the sepecified delegate
Comparator.
|
int | compare(Object obj1, Object obj2)- Compare using the delegate Comparator, but reversing the result.
|
delegate
private final Comparator delegate
ReverseComparator
public ReverseComparator(Comparator delegate)
Construct an instance with the sepecified delegate Comparator.
delegate - The comparator to delegate to
compare
public int compare(Object obj1,
Object obj2) Compare using the delegate Comparator, but reversing the result.
obj1 - The first object to compareobj2 - The second object to compare
- the result from the delegate
Comparator.compare(Object, Object)
reversing the value (i.e. positive becomes negative and vice versa)
Copyright (c) 2002-2010 Apache Software Foundation