aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ch/epfl/xblast/server/Board.java6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/ch/epfl/xblast/server/Board.java b/src/ch/epfl/xblast/server/Board.java
index f2a3c89..d7ca706 100644
--- a/src/ch/epfl/xblast/server/Board.java
+++ b/src/ch/epfl/xblast/server/Board.java
@@ -5,6 +5,7 @@ import ch.epfl.xblast.Cell;
5import ch.epfl.xblast.Lists; 5import ch.epfl.xblast.Lists;
6 6
7import java.util.ArrayList; 7import java.util.ArrayList;
8import java.util.Collections;
8import java.util.List; 9import java.util.List;
9 10
10/** 11/**
@@ -55,7 +56,7 @@ public final class Board {
55 if (blocks == null || blocks.size() != BLOCKS_LIST_SIZE) 56 if (blocks == null || blocks.size() != BLOCKS_LIST_SIZE)
56 throw new IllegalArgumentException(); 57 throw new IllegalArgumentException();
57 58
58 this.blocks = blocks; 59 this.blocks = new ArrayList<>(blocks);
59 } 60 }
60 61
61 /** 62 /**
@@ -148,6 +149,7 @@ public final class Board {
148 * @return a list of the Sequences of blocks of the board. 149 * @return a list of the Sequences of blocks of the board.
149 */ 150 */
150 public List<Sq<Block>> getBlocks() { 151 public List<Sq<Block>> getBlocks() {
151 return blocks; 152 List<Sq<Block>> immutableBlocks = Collections.unmodifiableList(new ArrayList<>(blocks));
153 return immutableBlocks;
152 } 154 }
153} 155}