diff options
author | Pacien TRAN-GIRARD | 2016-05-09 14:14:24 +0200 |
---|---|---|
committer | Pacien TRAN-GIRARD | 2016-05-09 14:14:24 +0200 |
commit | 10a9bc4bc745b49b2739d0e98eb8ad799fb8753e (patch) | |
tree | 515644688959d47f412f051f3e51c2d844a6cd96 /src/ch/epfl | |
parent | 6dc49829aa2bb4a2767d2c2d0c361cdcf8804dcd (diff) | |
download | xblast-10a9bc4bc745b49b2739d0e98eb8ad799fb8753e.tar.gz |
Enforce immutability
Diffstat (limited to 'src/ch/epfl')
-rw-r--r-- | src/ch/epfl/xblast/client/GameStateDeserializer.java | 8 |
1 files 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 { | |||
108 | * @return a list of Images corresponding to the serialized element | 108 | * @return a list of Images corresponding to the serialized element |
109 | */ | 109 | */ |
110 | private static List<Image> deserializeImageChunk(List<Byte> data, ImageCollection imageCollection) { | 110 | private static List<Image> deserializeImageChunk(List<Byte> data, ImageCollection imageCollection) { |
111 | return RunLengthEncoder.decode(data).stream() | 111 | return Collections.unmodifiableList(RunLengthEncoder.decode(data).stream() |
112 | .map(Byte::toUnsignedInt) | 112 | .map(Byte::toUnsignedInt) |
113 | .map(imageCollection::imageOrNull) | 113 | .map(imageCollection::imageOrNull) |
114 | .collect(Collectors.toList()); | 114 | .collect(Collectors.toList())); |
115 | } | 115 | } |
116 | 116 | ||
117 | /** | 117 | /** |
@@ -131,9 +131,9 @@ public final class GameStateDeserializer { | |||
131 | .range(0, Cell.SPIRAL_ORDER.size()).mapToObj(i -> i) | 131 | .range(0, Cell.SPIRAL_ORDER.size()).mapToObj(i -> i) |
132 | .collect(Collectors.toMap(Cell.SPIRAL_ORDER::get, spiralOrdered::get)); | 132 | .collect(Collectors.toMap(Cell.SPIRAL_ORDER::get, spiralOrdered::get)); |
133 | 133 | ||
134 | return Cell.ROW_MAJOR_ORDER.stream() | 134 | return Collections.unmodifiableList(Cell.ROW_MAJOR_ORDER.stream() |
135 | .map(imageMap::get) | 135 | .map(imageMap::get) |
136 | .collect(Collectors.toList()); | 136 | .collect(Collectors.toList())); |
137 | } | 137 | } |
138 | 138 | ||
139 | /** | 139 | /** |