MCPcopy Create free account
hub / github.com/antlr/codebuff / partition

Method partition

output/java_guava/1.4.18/Ordering.java:802–815  ·  view source on GitHub ↗
(E[] values, int left, int right, int pivotIndex)

Source from the content-addressed store, hash-verified

800 }
801
802 private <E extends T> int partition(E[] values, int left, int right, int pivotIndex) {
803 E pivotValue = values[pivotIndex];
804 values[pivotIndex] = values[right];
805 values[right] = pivotValue;
806 int storeIndex = left;
807 for (int i = left; i < right; i++) {
808 if (compare(values[i], pivotValue) < 0) {
809 ObjectArrays.swap(values, storeIndex, i);
810 storeIndex++;
811 }
812 }
813 ObjectArrays.swap(values, right, storeIndex);
814 return storeIndex;
815 }
816
817 /**
818 * Returns the {@code k} greatest elements of the given iterable according to

Callers 1

leastOfMethod · 0.95

Calls 2

compareMethod · 0.95
swapMethod · 0.95

Tested by

no test coverage detected