From be2fb1fb5cbf062a9a6925b2d856d8115df700c6 Mon Sep 17 00:00:00 2001 From: romanschenk37 <84532681+romanschenk37@users.noreply.github.com> Date: Fri, 25 Mar 2022 23:06:20 +0100 Subject: [PATCH] code cleanup --- src/main/java/ch/zhaw/pm2/racetrack/Game.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/java/ch/zhaw/pm2/racetrack/Game.java b/src/main/java/ch/zhaw/pm2/racetrack/Game.java index b6aca51..755af8b 100644 --- a/src/main/java/ch/zhaw/pm2/racetrack/Game.java +++ b/src/main/java/ch/zhaw/pm2/racetrack/Game.java @@ -6,6 +6,7 @@ import ch.zhaw.pm2.racetrack.strategy.*; import java.io.File; import java.io.FileNotFoundException; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import static ch.zhaw.pm2.racetrack.PositionVector.Direction; @@ -34,9 +35,7 @@ public class Game implements GameSpecification { */ public boolean initPhase() { if (config.getTrackDirectory().listFiles().length > 0) { - List tracks = new ArrayList<>(); - - File selectedTrack = config.getTrackDirectory().listFiles()[userInterface.selectOption("Select Track file", tracks)]; + File selectedTrack = config.getTrackDirectory().listFiles()[userInterface.selectOption("Select Track file", Arrays.asList(config.getTrackDirectory().list()))]; try { selectTrack(selectedTrack); } catch (FileNotFoundException e) {