summaryrefslogtreecommitdiff
path: root/src/ch/epfl/maze/physical/Maze.java
diff options
context:
space:
mode:
authorPacien TRAN-GIRARD2015-11-24 15:18:13 +0100
committerPacien TRAN-GIRARD2015-11-24 15:18:13 +0100
commit4175fa6eece8e5e557710d2cf810695705bb5968 (patch)
tree8f11d9d194c458dc59fda41160ccf96a372a0562 /src/ch/epfl/maze/physical/Maze.java
parentbda6db0eb45b4fb10d9644d9b7bf2699e17a0e5d (diff)
downloadmaze-solver-4175fa6eece8e5e557710d2cf810695705bb5968.tar.gz
Use Set instead of List for Animals
Diffstat (limited to 'src/ch/epfl/maze/physical/Maze.java')
-rw-r--r--src/ch/epfl/maze/physical/Maze.java16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/ch/epfl/maze/physical/Maze.java b/src/ch/epfl/maze/physical/Maze.java
index d3ba645..d3273c8 100644
--- a/src/ch/epfl/maze/physical/Maze.java
+++ b/src/ch/epfl/maze/physical/Maze.java
@@ -1,7 +1,7 @@
1package ch.epfl.maze.physical; 1package ch.epfl.maze.physical;
2 2
3import java.util.ArrayList; 3import java.util.HashSet;
4import java.util.List; 4import java.util.Set;
5 5
6/** 6/**
7 * Maze in which an animal starts from a starting point and must find the exit. 7 * Maze in which an animal starts from a starting point and must find the exit.
@@ -13,8 +13,8 @@ import java.util.List;
13 */ 13 */
14public final class Maze extends World { 14public final class Maze extends World {
15 15
16 private final List<Animal> animals; 16 private final Set<Animal> animals;
17 private final List<Animal> animalHistory; 17 private final Set<Animal> animalHistory;
18 18
19 /** 19 /**
20 * Constructs a Maze with a labyrinth structure. 20 * Constructs a Maze with a labyrinth structure.
@@ -24,8 +24,8 @@ public final class Maze extends World {
24 public Maze(int[][] labyrinth) { 24 public Maze(int[][] labyrinth) {
25 super(labyrinth); 25 super(labyrinth);
26 26
27 this.animals = new ArrayList<>(); 27 this.animals = new HashSet<>();
28 this.animalHistory = new ArrayList<>(); 28 this.animalHistory = new HashSet<>();
29 } 29 }
30 30
31 @Override 31 @Override
@@ -34,8 +34,8 @@ public final class Maze extends World {
34 } 34 }
35 35
36 @Override 36 @Override
37 public List<Animal> getAnimals() { 37 public Set<Animal> getAnimalSet() {
38 return this.animals; 38 return new HashSet<>(this.animals);
39 } 39 }
40 40
41 /** 41 /**