ReverseComparatorpublic class ReverseComparator extends Object implements Serializable, ComparatorReverses the result of comparing two objects using
the delegate {@link Comparator}. |
Fields Summary |
---|
private final Comparator | delegate |
Constructors Summary |
---|
public ReverseComparator(Comparator delegate)Construct an instance with the sepecified delegate {@link Comparator}.
if (delegate == null) {
throw new IllegalArgumentException("Delegate comparator is missing");
}
this.delegate = delegate;
|
Methods Summary |
---|
public int | compare(java.lang.Object obj1, java.lang.Object obj2)Compare using the delegate Comparator, but reversing the result.
return delegate.compare(obj2, obj1); // parameters switched round
|
|