Skip to content

Commit

Permalink
Improve CharStore sort
Browse files Browse the repository at this point in the history
  • Loading branch information
gc-garcol committed Sep 26, 2023
1 parent 6e7a73d commit 7d32df6
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,13 @@ public void sort(
if (comparator == null) {
Arrays.sort(array, from, until);
} else {
final Character[] chars = new Character[array.length];
for (int i = 0; i < array.length; ++i) {
chars[i] = array[i];
final Character[] chars = new Character[until - from];
for (int i = from; i < until; ++i) {
chars[i - from] = array[i];
}
Arrays.sort(chars, from, until, comparator);
for (int i = 0; i < array.length; ++i) {
array[i] = chars[i];
Arrays.sort(chars, comparator);
for (int i = from; i < until; ++i) {
array[i] = chars[i - from];
}
}
}
Expand Down

0 comments on commit 7d32df6

Please sign in to comment.