Skip to content

Commit

Permalink
fix: order of ranking was reversed
Browse files Browse the repository at this point in the history
  • Loading branch information
RoinujNosde committed Aug 17, 2022
1 parent 4d83695 commit f31ff49
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,13 @@ public double getTotalInvestments() {
if (rate == null) {
return Collections.emptyList();
}
return investors.stream().sorted(Investor.comparator(rate)).limit(max).collect(Collectors.toList());
investors.sort(Investor.comparator(rate).reversed());

ArrayList<Investor> topList = new ArrayList<>();
for (int i = 0; i < investors.size() && i < max; i++) {
topList.add(investors.get(i));
}
return topList;
}

/**
Expand Down

0 comments on commit f31ff49

Please sign in to comment.