public final class SmoothSort extends Object
| Modifier and Type | Method and Description |
|---|---|
static <T extends Comparable<? super T>> |
sort(List<T> list)
Sorts the given list according to the elements' natural ordering.
|
static <T> void |
sort(List<T> list,
Comparator<? super T> comp)
Sorts the given list according to the specified comparator.
|
static <T extends Comparable<? super T>> |
sort(T[] array)
Sorts the given array according to the elements' natural ordering.
|
static <T> void |
sort(T[] array,
Comparator<? super T> comp)
Sorts the given array according to the specified comparator.
|
public static <T extends Comparable<? super T>> void sort(List<T> list)
Collections.sort(List), except it will utilize the
smoothsort algorithm instead of Java's default implementation (mergesort in versions 6 and
earlier, timsort in versions 7 and up).list - the list which will be sorted in placepublic static <T> void sort(List<T> list, Comparator<? super T> comp)
Collections.sort(List, Comparator), except it will utilize the smoothsort algorithm
instead of Java's default implementation (mergesort in versions 6 and earlier, timsort in
versions 7 and up).list - the list which will be sorted in placepublic static <T extends Comparable<? super T>> void sort(T[] array)
Arrays.sort(Object[]), except it will utilize the
smoothsort algorithm instead of Java's default implementation (mergesort in versions 6 and
earlier, timsort in versions 7 and up).array - the array which will be sorted in placepublic static <T> void sort(T[] array,
Comparator<? super T> comp)
Arrays.sort(Object[], Comparator), except it will utilize the smoothsort algorithm
instead of Java's default implementation (mergesort in versions 6 and earlier, timsort in
versions 7 and up).array - the array which will be sorted in place