From 726a4ba8047be847e0bc3af7b376f41d2760b635 Mon Sep 17 00:00:00 2001 From: pacien Date: Fri, 2 Feb 2018 10:56:15 +0100 Subject: Remove criticism Signed-off-by: pacien --- src/test/java/fr/umlv/java/wallj/board/PathFinderTest.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/test/java') diff --git a/src/test/java/fr/umlv/java/wallj/board/PathFinderTest.java b/src/test/java/fr/umlv/java/wallj/board/PathFinderTest.java index 3af4679..be615b7 100644 --- a/src/test/java/fr/umlv/java/wallj/board/PathFinderTest.java +++ b/src/test/java/fr/umlv/java/wallj/board/PathFinderTest.java @@ -7,6 +7,7 @@ import java.io.IOException; import java.net.URISyntaxException; import java.nio.file.Path; import java.nio.file.Paths; +import java.util.ArrayList; import java.util.List; /** @@ -19,8 +20,10 @@ final class PathFinderTest { } private boolean isPathConnected(List path) { - for (int i = 1; i < path.size(); ++i) { - TileVec2 predecessor = path.get(i - 1), current = path.get(i); + List runPath = new ArrayList<>(path); + + for (int i = 1; i < runPath.size(); ++i) { + TileVec2 predecessor = runPath.get(i - 1), current = runPath.get(i); if (Math.abs(predecessor.getCol() - current.getCol()) > 1 || Math.abs(predecessor.getRow() - current.getRow()) > 1) return false; -- cgit v1.2.3