From 1a1351c38f825e549b01be28d8d9315373cc8764 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Tue, 4 Oct 2022 21:36:02 +0200 Subject: [PATCH] Implement the `createNameList` method --- app/src/main/java/ch/nuth/zhaw/exbox/RankingListServer.java | 5 +++-- app/src/test/java/ch/nuth/zhaw/exbox/ADS3_4_test.java | 1 - 2 files changed, 3 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 9801b24..22bda9b 100644 --- a/app/src/main/java/ch/nuth/zhaw/exbox/RankingListServer.java +++ b/app/src/main/java/ch/nuth/zhaw/exbox/RankingListServer.java @@ -60,8 +60,9 @@ public class RankingListServer implements CommandExecutor { } public String createNameList(List competitorList) { - // TODO Implement - return ""; + return String.join( + System.lineSeparator(), + competitorList.stream().sorted(new AlphaComparatorCompetitor()).map((competitor) -> competitor.toString()).toList()); } public String execute(String rankingList) { diff --git a/app/src/test/java/ch/nuth/zhaw/exbox/ADS3_4_test.java b/app/src/test/java/ch/nuth/zhaw/exbox/ADS3_4_test.java index 4c800ea..61315f1 100644 --- a/app/src/test/java/ch/nuth/zhaw/exbox/ADS3_4_test.java +++ b/app/src/test/java/ch/nuth/zhaw/exbox/ADS3_4_test.java @@ -3,7 +3,6 @@ package ch.nuth.zhaw.exbox; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import java.util.Collections; import java.util.LinkedList; import java.util.List;