From 10a9bc4bc745b49b2739d0e98eb8ad799fb8753e Mon Sep 17 00:00:00 2001 From: Pacien TRAN-GIRARD Date: Mon, 9 May 2016 14:14:24 +0200 Subject: Enforce immutability --- src/ch/epfl/xblast/client/GameStateDeserializer.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ch/epfl/xblast/client/GameStateDeserializer.java b/src/ch/epfl/xblast/client/GameStateDeserializer.java index 2c06dbc..e2039ed 100644 --- a/src/ch/epfl/xblast/client/GameStateDeserializer.java +++ b/src/ch/epfl/xblast/client/GameStateDeserializer.java @@ -108,10 +108,10 @@ public final class GameStateDeserializer { * @return a list of Images corresponding to the serialized element */ private static List deserializeImageChunk(List data, ImageCollection imageCollection) { - return RunLengthEncoder.decode(data).stream() + return Collections.unmodifiableList(RunLengthEncoder.decode(data).stream() .map(Byte::toUnsignedInt) .map(imageCollection::imageOrNull) - .collect(Collectors.toList()); + .collect(Collectors.toList())); } /** @@ -131,9 +131,9 @@ public final class GameStateDeserializer { .range(0, Cell.SPIRAL_ORDER.size()).mapToObj(i -> i) .collect(Collectors.toMap(Cell.SPIRAL_ORDER::get, spiralOrdered::get)); - return Cell.ROW_MAJOR_ORDER.stream() + return Collections.unmodifiableList(Cell.ROW_MAJOR_ORDER.stream() .map(imageMap::get) - .collect(Collectors.toList()); + .collect(Collectors.toList())); } /** -- cgit v1.2.3