private static final class CollectionUtil.ListIntroSorter<T> extends IntroSorter
Modifier and Type | Field and Description |
---|---|
(package private) java.util.Comparator<? super T> |
comp |
(package private) java.util.List<T> |
list |
(package private) T |
pivot |
BINARY_SORT_THRESHOLD
Constructor and Description |
---|
ListIntroSorter(java.util.List<T> list,
java.util.Comparator<? super T> comp) |
Modifier and Type | Method and Description |
---|---|
protected int |
compare(int i,
int j)
Compare entries found in slots
i and j . |
protected int |
comparePivot(int j)
Compare the pivot with the slot at
j , similarly to
compare(i, j) . |
protected void |
setPivot(int i)
Save the value at slot
i so that it can later be used as a
pivot, see Sorter.comparePivot(int) . |
protected void |
swap(int i,
int j)
Swap values at slots
i and j . |
quicksort, sort
binarySort, binarySort, checkRange, doRotate, heapChild, heapify, heapParent, heapSort, lower, lower2, mergeInPlace, reverse, rotate, siftDown, upper, upper2
T pivot
final java.util.List<T> list
final java.util.Comparator<? super T> comp
protected void setPivot(int i)
Sorter
i
so that it can later be used as a
pivot, see Sorter.comparePivot(int)
.setPivot
in class IntroSorter
protected void swap(int i, int j)
Sorter
i
and j
.protected int compare(int i, int j)
Sorter
i
and j
.
The contract for the returned value is the same as
Comparator.compare(Object, Object)
.compare
in class IntroSorter
protected int comparePivot(int j)
Sorter
j
, similarly to
compare(i, j)
.comparePivot
in class IntroSorter