Add in the sort that was removed accidentally

This commit is contained in:
Houston Putman 2024-10-15 17:08:57 -05:00
parent d1e021055f
commit 48c3f3548e
1 changed files with 3 additions and 0 deletions

View File

@ -16,6 +16,8 @@
*/ */
package org.apache.lucene.util; package org.apache.lucene.util;
import java.util.Arrays;
/** /**
* An implementation of a selection algorithm, ie. computing the k-th greatest value from a * An implementation of a selection algorithm, ie. computing the k-th greatest value from a
* collection. * collection.
@ -39,6 +41,7 @@ public abstract class Selector {
public void multiSelect(int from, int to, int[] k) { public void multiSelect(int from, int to, int[] k) {
// k needs to be sorted, so copy the array // k needs to be sorted, so copy the array
k = ArrayUtil.copyArray(k); k = ArrayUtil.copyArray(k);
Arrays.sort(k);
checkMultiArgs(from, to, k); checkMultiArgs(from, to, k);
multiSelect(from, to, k, 0, k.length); multiSelect(from, to, k, 0, k.length);
} }