Added an rsort() that uses the new Comparators.REVERSE_COMPARABLE

git-svn-id: https://samskivert.googlecode.com/svn/trunk@1482 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
ray
2004-08-12 02:38:02 +00:00
parent 94b25a5e46
commit 512f99a5ef
@@ -52,6 +52,16 @@ public class SortableArrayList extends AbstractList
sort(Comparators.COMPARABLE); sort(Comparators.COMPARABLE);
} }
/**
* Sorts the elements in this list using the quick sort algorithm
* according to their reverse natural ordering. The elements must
* implement {@link Comparable} and all be mutually comparable.
*/
public void rsort ()
{
sort(Comparators.REVERSE_COMPARABLE);
}
/** /**
* Sorts the elements in this list with the supplied element * Sorts the elements in this list with the supplied element
* comparator using the quick sort algorithm (which does not involve * comparator using the quick sort algorithm (which does not involve
@@ -61,7 +71,7 @@ public class SortableArrayList extends AbstractList
public void sort (Comparator comp) public void sort (Comparator comp)
{ {
if (_size > 1) { if (_size > 1) {
QuickSort.csort(_elements, 0, _size-1, comp); QuickSort.sort(_elements, 0, _size-1, comp);
} }
} }