Skip to content

Commit

Permalink
fix sort
Browse files Browse the repository at this point in the history
  • Loading branch information
saimu.msm committed Mar 6, 2024
1 parent 6d3e40e commit 3f1e48d
Showing 1 changed file with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,19 @@ public void sort(String order, String... priorities) {
}
int finalIndex = index;
values.sort((o1, o2) -> {
Double d1 = Double.parseDouble(String.valueOf(o1[finalIndex]));
Double d2 = Double.parseDouble(String.valueOf(o2[finalIndex]));
Double d1;
Double d2;
if (o1.length <= finalIndex) {
d1 = Double.MIN_VALUE;
} else {
d1 = Double.parseDouble(String.valueOf(o1[finalIndex]));
}
if (o2.length <= finalIndex) {
d2 = Double.MIN_VALUE;
} else {
d2 = Double.parseDouble(String.valueOf(o2[finalIndex]));
}

if (StringUtils.equalsIgnoreCase(order, "asc")) {
return d1.compareTo(d2);
} else {
Expand Down

0 comments on commit 3f1e48d

Please sign in to comment.