From 4175fa6eece8e5e557710d2cf810695705bb5968 Mon Sep 17 00:00:00 2001 From: Pacien TRAN-GIRARD Date: Tue, 24 Nov 2015 15:18:13 +0100 Subject: Use Set instead of List for Animals --- src/ch/epfl/maze/physical/Maze.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/ch/epfl/maze/physical/Maze.java') 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 @@ package ch.epfl.maze.physical; -import java.util.ArrayList; -import java.util.List; +import java.util.HashSet; +import java.util.Set; /** * Maze in which an animal starts from a starting point and must find the exit. @@ -13,8 +13,8 @@ import java.util.List; */ public final class Maze extends World { - private final List animals; - private final List animalHistory; + private final Set animals; + private final Set animalHistory; /** * Constructs a Maze with a labyrinth structure. @@ -24,8 +24,8 @@ public final class Maze extends World { public Maze(int[][] labyrinth) { super(labyrinth); - this.animals = new ArrayList<>(); - this.animalHistory = new ArrayList<>(); + this.animals = new HashSet<>(); + this.animalHistory = new HashSet<>(); } @Override @@ -34,8 +34,8 @@ public final class Maze extends World { } @Override - public List getAnimals() { - return this.animals; + public Set getAnimalSet() { + return new HashSet<>(this.animals); } /** -- cgit v1.2.3