From 6722d8ee0218a33b694f4b00a628880e6f530e5a Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Tue, 4 Oct 2022 21:39:56 +0200 Subject: [PATCH] Fix backwards compatibility --- .../main/java/ch/nuth/zhaw/exbox/RankingListServer.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/ch/nuth/zhaw/exbox/RankingListServer.java b/app/src/main/java/ch/nuth/zhaw/exbox/RankingListServer.java index 22bda9b..ece95b1 100644 --- a/app/src/main/java/ch/nuth/zhaw/exbox/RankingListServer.java +++ b/app/src/main/java/ch/nuth/zhaw/exbox/RankingListServer.java @@ -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 competitorList) { - List competitors = competitorList.stream().sorted().toList(); + List 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 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) {