aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPacien TRAN-GIRARD2016-05-09 12:57:39 +0200
committerPacien TRAN-GIRARD2016-05-09 12:57:39 +0200
commit400a818b298bbb95771a5c63b330f0276114ab3e (patch)
treec8c57b3bf1d44cdafc1da7083eb5830985a6e591 /src
parent94f800ca9aee0ec3f0803bbf92068b5c4645a260 (diff)
downloadxblast-400a818b298bbb95771a5c63b330f0276114ab3e.tar.gz
Use preferably immutable interfaces
Diffstat (limited to 'src')
-rw-r--r--src/ch/epfl/xblast/Cell.java12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/ch/epfl/xblast/Cell.java b/src/ch/epfl/xblast/Cell.java
index 8214066..9720281 100644
--- a/src/ch/epfl/xblast/Cell.java
+++ b/src/ch/epfl/xblast/Cell.java
@@ -30,12 +30,12 @@ public final class Cell {
30 /** 30 /**
31 * The list of the board's Cell-s, major-ordered. 31 * The list of the board's Cell-s, major-ordered.
32 */ 32 */
33 public static final List<Cell> ROW_MAJOR_ORDER = Collections.unmodifiableList(rowMajorOrder()); 33 public static final List<Cell> ROW_MAJOR_ORDER = rowMajorOrder();
34 34
35 /** 35 /**
36 * The list of the board's Cell-s, spiral-ordered. 36 * The list of the board's Cell-s, spiral-ordered.
37 */ 37 */
38 public static final List<Cell> SPIRAL_ORDER = Collections.unmodifiableList(spiralOrder()); 38 public static final List<Cell> SPIRAL_ORDER = spiralOrder();
39 39
40 /** 40 /**
41 * The coordinates of the Cell. 41 * The coordinates of the Cell.
@@ -69,14 +69,14 @@ public final class Cell {
69 * 69 *
70 * @return the list of Cell-s 70 * @return the list of Cell-s
71 */ 71 */
72 private static ArrayList<Cell> rowMajorOrder() { 72 private static List<Cell> rowMajorOrder() {
73 ArrayList<Cell> list = new ArrayList<>(COUNT); 73 ArrayList<Cell> list = new ArrayList<>(COUNT);
74 74
75 for (int row = 0; row < ROWS; ++row) 75 for (int row = 0; row < ROWS; ++row)
76 for (int col = 0; col < COLUMNS; ++col) 76 for (int col = 0; col < COLUMNS; ++col)
77 list.add(new Cell(col, row)); 77 list.add(new Cell(col, row));
78 78
79 return list; 79 return Collections.unmodifiableList(list);
80 } 80 }
81 81
82 /** 82 /**
@@ -84,7 +84,7 @@ public final class Cell {
84 * 84 *
85 * @return the list of Cell-s 85 * @return the list of Cell-s
86 */ 86 */
87 private static ArrayList<Cell> spiralOrder() { 87 private static List<Cell> spiralOrder() {
88 ArrayList<Cell> list = new ArrayList<>(COUNT); 88 ArrayList<Cell> list = new ArrayList<>(COUNT);
89 ArrayList<Integer> ix = range(0, COLUMNS, 1); 89 ArrayList<Integer> ix = range(0, COLUMNS, 1);
90 ArrayList<Integer> iy = range(0, ROWS, 1); 90 ArrayList<Integer> iy = range(0, ROWS, 1);
@@ -101,7 +101,7 @@ public final class Cell {
101 horizontal = !horizontal; 101 horizontal = !horizontal;
102 } 102 }
103 103
104 return list; 104 return Collections.unmodifiableList(list);
105 } 105 }
106 106
107 /** 107 /**