From 512f99a5ef91b7633ddccababcfe9466e722ef63 Mon Sep 17 00:00:00 2001 From: ray Date: Thu, 12 Aug 2004 02:38:02 +0000 Subject: [PATCH] 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 --- .../java/com/samskivert/util/SortableArrayList.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/projects/samskivert/src/java/com/samskivert/util/SortableArrayList.java b/projects/samskivert/src/java/com/samskivert/util/SortableArrayList.java index d98ec4f8..8767d600 100644 --- a/projects/samskivert/src/java/com/samskivert/util/SortableArrayList.java +++ b/projects/samskivert/src/java/com/samskivert/util/SortableArrayList.java @@ -52,6 +52,16 @@ public class SortableArrayList extends AbstractList 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 * comparator using the quick sort algorithm (which does not involve @@ -61,7 +71,7 @@ public class SortableArrayList extends AbstractList public void sort (Comparator comp) { if (_size > 1) { - QuickSort.csort(_elements, 0, _size-1, comp); + QuickSort.sort(_elements, 0, _size-1, comp); } }