Fix backwards compatibility

This commit is contained in:
Manuel Thalmann 2022-10-04 21:39:56 +02:00
parent 1a1351c38f
commit 6722d8ee02

View file

@ -4,6 +4,7 @@ import java.io.BufferedReader;
import java.io.StringReader;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
public class RankingListServer implements CommandExecutor {
/**
@ -39,7 +40,7 @@ public class RankingListServer implements CommandExecutor {
}
public String createSortedText(List<Competitor> competitorList) {
List<Competitor> competitors = competitorList.stream().sorted().toList();
List<Competitor> competitors = competitorList.stream().sorted().collect(Collectors.toList());
String previousTime = null;
int previousRank = 1;
@ -56,13 +57,15 @@ public class RankingListServer implements CommandExecutor {
return String.join(
System.lineSeparator(),
competitors.stream().map((competitor) -> competitor.toString()).toList());
competitors.stream().map(
(competitor) -> competitor.toString()).collect(Collectors.toList()));
}
public String createNameList(List<Competitor> competitorList) {
return String.join(
System.lineSeparator(),
competitorList.stream().sorted(new AlphaComparatorCompetitor()).map((competitor) -> competitor.toString()).toList());
competitorList.stream().sorted(new AlphaComparatorCompetitor()).map(
(competitor) -> competitor.toString()).collect(Collectors.toList()));
}
public String execute(String rankingList) {