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:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user