no message
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130625 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
520dc72714
commit
61445ae559
|
@ -1,5 +1,6 @@
|
|||
package org.apache.commons.collections.comparators;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
@ -20,24 +21,25 @@ public class TestReverseComparator extends TestComparator {
|
|||
|
||||
/**
|
||||
* For the purposes of this test, return a
|
||||
* ReverseComparator that wraps a ComparableComparator,
|
||||
* which should produce a backward-ordered list
|
||||
* identical to the java.util.Collection.reverseOrder()
|
||||
* Comparator.
|
||||
* ReverseComparator that wraps the java.util.Collections.reverseOrder()
|
||||
* Comparator. The resulting comparator shouls
|
||||
* sort according to natural Order. (Note: we wrap
|
||||
* a Comparator taken from the JDK so that we can
|
||||
* save a "canonical" form in CVS.
|
||||
*
|
||||
* @return Comparator that reverses a "natural" order
|
||||
* @return Comparator that returns "natural" order
|
||||
*/
|
||||
public Comparator makeComparator() {
|
||||
return new ReverseComparator(new ComparableComparator());
|
||||
return new ReverseComparator(Collections.reverseOrder());
|
||||
}
|
||||
|
||||
public List getComparableObjectsOrdered() {
|
||||
List list = new LinkedList();
|
||||
list.add(new Integer(5));
|
||||
list.add(new Integer(4));
|
||||
list.add(new Integer(3));
|
||||
list.add(new Integer(2));
|
||||
list.add(new Integer(1));
|
||||
list.add(new Integer(2));
|
||||
list.add(new Integer(3));
|
||||
list.add(new Integer(4));
|
||||
list.add(new Integer(5));
|
||||
return list;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue