MCPcopy Create free account
hub / github.com/ReadyTalk/avian / siftDown

Method siftDown

classpath/java/util/Collections.java:119–136  ·  view source on GitHub ↗
(List<T> list, Comparator<? super T> comparator,
    int i, int count, int offset)

Source from the content-addressed store, hash-verified

117 }
118
119 private static <T> void siftDown(List<T> list, Comparator<? super T> comparator,
120 int i, int count, int offset)
121 {
122 T value = list.get(offset + i);
123 while (i < count / 2) {
124 int child = 2 * i + 1;
125 if (child + 1 < count &&
126 comparator.compare(list.get(child), list.get(child + 1)) < 0) {
127 ++child;
128 }
129 if (comparator.compare(value, list.get(child)) >= 0) {
130 break;
131 }
132 list.set(offset + i, list.get(offset + child));
133 i = child;
134 }
135 list.set(offset + i, value);
136 }
137
138 private static <T> void insertionSort(List<T> list,
139 Comparator<? super T> comparator)

Callers 1

heapSortMethod · 0.95

Calls 3

getMethod · 0.65
compareMethod · 0.65
setMethod · 0.65

Tested by

no test coverage detected