Package org.apache.lucene.util
Class CollectionUtil
- java.lang.Object
 - 
- org.apache.lucene.util.CollectionUtil
 
 
- 
public final class CollectionUtil extends java.lang.ObjectMethods for manipulating (sorting) collections. Sort methods work directly on the supplied lists and don't copy to/from arrays before/after. For medium size collections as used in the Lucene indexer that is much more efficient. 
- 
- 
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T extends java.lang.Comparable<? super T>>
voidintroSort(java.util.List<T> list)Sorts the given random accessListin natural order.static <T> voidintroSort(java.util.List<T> list, java.util.Comparator<? super T> comp)Sorts the given random accessListusing theComparator.static <T extends java.lang.Comparable<? super T>>
voidtimSort(java.util.List<T> list)Sorts the given random accessListin natural order.static <T> voidtimSort(java.util.List<T> list, java.util.Comparator<? super T> comp)Sorts the given random accessListusing theComparator. 
 - 
 
- 
- 
Method Detail
- 
introSort
public static <T> void introSort(java.util.List<T> list, java.util.Comparator<? super T> comp)Sorts the given random accessListusing theComparator. The list must implementRandomAccess. This method uses the intro sort algorithm, but falls back to insertion sort for small lists.- Throws:
 java.lang.IllegalArgumentException- if list is e.g. a linked list without random access.
 
- 
introSort
public static <T extends java.lang.Comparable<? super T>> void introSort(java.util.List<T> list)
Sorts the given random accessListin natural order. The list must implementRandomAccess. This method uses the intro sort algorithm, but falls back to insertion sort for small lists.- Throws:
 java.lang.IllegalArgumentException- if list is e.g. a linked list without random access.
 
- 
timSort
public static <T> void timSort(java.util.List<T> list, java.util.Comparator<? super T> comp)Sorts the given random accessListusing theComparator. The list must implementRandomAccess. This method uses the Tim sort algorithm, but falls back to binary sort for small lists.- Throws:
 java.lang.IllegalArgumentException- if list is e.g. a linked list without random access.
 
- 
timSort
public static <T extends java.lang.Comparable<? super T>> void timSort(java.util.List<T> list)
Sorts the given random accessListin natural order. The list must implementRandomAccess. This method uses the Tim sort algorithm, but falls back to binary sort for small lists.- Throws:
 java.lang.IllegalArgumentException- if list is e.g. a linked list without random access.
 
 - 
 
 -