From 400a818b298bbb95771a5c63b330f0276114ab3e Mon Sep 17 00:00:00 2001 From: Pacien TRAN-GIRARD Date: Mon, 9 May 2016 12:57:39 +0200 Subject: Use preferably immutable interfaces --- src/ch/epfl/xblast/Cell.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src') 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 { /** * The list of the board's Cell-s, major-ordered. */ - public static final List ROW_MAJOR_ORDER = Collections.unmodifiableList(rowMajorOrder()); + public static final List ROW_MAJOR_ORDER = rowMajorOrder(); /** * The list of the board's Cell-s, spiral-ordered. */ - public static final List SPIRAL_ORDER = Collections.unmodifiableList(spiralOrder()); + public static final List SPIRAL_ORDER = spiralOrder(); /** * The coordinates of the Cell. @@ -69,14 +69,14 @@ public final class Cell { * * @return the list of Cell-s */ - private static ArrayList rowMajorOrder() { + private static List rowMajorOrder() { ArrayList list = new ArrayList<>(COUNT); for (int row = 0; row < ROWS; ++row) for (int col = 0; col < COLUMNS; ++col) list.add(new Cell(col, row)); - return list; + return Collections.unmodifiableList(list); } /** @@ -84,7 +84,7 @@ public final class Cell { * * @return the list of Cell-s */ - private static ArrayList spiralOrder() { + private static List spiralOrder() { ArrayList list = new ArrayList<>(COUNT); ArrayList ix = range(0, COLUMNS, 1); ArrayList iy = range(0, ROWS, 1); @@ -101,7 +101,7 @@ public final class Cell { horizontal = !horizontal; } - return list; + return Collections.unmodifiableList(list); } /** -- cgit v1.2.3