public final class CollectionUtil
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static <T extends java.lang.Comparable<? super T>> |
insertionSort(java.util.List<T> list)
Sorts the given random access
List in natural order. |
static <T> void |
insertionSort(java.util.List<T> list,
java.util.Comparator<? super T> comp)
Sorts the given random access
List using the Comparator. |
static <T extends java.lang.Comparable<? super T>> |
mergeSort(java.util.List<T> list)
Sorts the given random access
List in natural order. |
static <T> void |
mergeSort(java.util.List<T> list,
java.util.Comparator<? super T> comp)
Sorts the given random access
List using the Comparator. |
static <T extends java.lang.Comparable<? super T>> |
quickSort(java.util.List<T> list)
Sorts the given random access
List in natural order. |
static <T> void |
quickSort(java.util.List<T> list,
java.util.Comparator<? super T> comp)
Sorts the given random access
List using the Comparator. |
public static <T> void quickSort(java.util.List<T> list,
java.util.Comparator<? super T> comp)
List using the Comparator.
The list must implement RandomAccess. This method uses the quick sort
algorithm, but falls back to insertion sort for small lists.java.lang.IllegalArgumentException - if list is e.g. a linked list without random access.public static <T extends java.lang.Comparable<? super T>> void quickSort(java.util.List<T> list)
List in natural order.
The list must implement RandomAccess. This method uses the quick sort
algorithm, but falls back to insertion sort for small lists.java.lang.IllegalArgumentException - if list is e.g. a linked list without random access.public static <T> void mergeSort(java.util.List<T> list,
java.util.Comparator<? super T> comp)
List using the Comparator.
The list must implement RandomAccess. This method uses the merge sort
algorithm, but falls back to insertion sort for small lists.java.lang.IllegalArgumentException - if list is e.g. a linked list without random access.public static <T extends java.lang.Comparable<? super T>> void mergeSort(java.util.List<T> list)
List in natural order.
The list must implement RandomAccess. This method uses the merge sort
algorithm, but falls back to insertion sort for small lists.java.lang.IllegalArgumentException - if list is e.g. a linked list without random access.public static <T> void insertionSort(java.util.List<T> list,
java.util.Comparator<? super T> comp)
List using the Comparator.
The list must implement RandomAccess. This method uses the insertion sort
algorithm. It is only recommended to use this algorithm for partially sorted small lists!java.lang.IllegalArgumentException - if list is e.g. a linked list without random access.public static <T extends java.lang.Comparable<? super T>> void insertionSort(java.util.List<T> list)
List in natural order.
The list must implement RandomAccess. This method uses the insertion sort
algorithm. It is only recommended to use this algorithm for partially sorted small lists!java.lang.IllegalArgumentException - if list is e.g. a linked list without random access.Copyright © 2000-2022 Apache Software Foundation. All Rights Reserved.