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

Method partition

corpus/java/training/guava/collect/Ordering.java:794–809  ·  view source on GitHub ↗
(E[] values, int left, int right, int pivotIndex)

Source from the content-addressed store, hash-verified

792 }
793
794 private <E extends T> int partition(E[] values, int left, int right, int pivotIndex) {
795 E pivotValue = values[pivotIndex];
796
797 values[pivotIndex] = values[right];
798 values[right] = pivotValue;
799
800 int storeIndex = left;
801 for (int i = left; i < right; i++) {
802 if (compare(values[i], pivotValue) < 0) {
803 ObjectArrays.swap(values, storeIndex, i);
804 storeIndex++;
805 }
806 }
807 ObjectArrays.swap(values, right, storeIndex);
808 return storeIndex;
809 }
810
811 /**
812 * 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