aboutsummaryrefslogtreecommitdiff
path: root/src/ch
diff options
context:
space:
mode:
authorPacien TRAN-GIRARD2016-04-06 22:48:59 +0200
committerPacien TRAN-GIRARD2016-04-06 22:48:59 +0200
commit873a3084a9993f9dcf8d575563a6a018ed85dbb6 (patch)
treeaf5190f8103dab4b8fd6ff723b77f41e6ebf1778 /src/ch
parent0ce2048d2c34efb6335722a8d09c37afca78c583 (diff)
downloadxblast-873a3084a9993f9dcf8d575563a6a018ed85dbb6.tar.gz
Optimize nextExplosions
Diffstat (limited to 'src/ch')
-rw-r--r--src/ch/epfl/xblast/server/GameState.java11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/ch/epfl/xblast/server/GameState.java b/src/ch/epfl/xblast/server/GameState.java
index d648cef..77e91f2 100644
--- a/src/ch/epfl/xblast/server/GameState.java
+++ b/src/ch/epfl/xblast/server/GameState.java
@@ -232,13 +232,10 @@ public final class GameState {
232 * @return the next explosion state 232 * @return the next explosion state
233 */ 233 */
234 private static List<Sq<Sq<Cell>>> nextExplosions(List<Sq<Sq<Cell>>> explosions0) { 234 private static List<Sq<Sq<Cell>>> nextExplosions(List<Sq<Sq<Cell>>> explosions0) {
235 List<Sq<Sq<Cell>>> explosions1 = new ArrayList<>(); 235 return explosions0.stream()
236 for (Sq<Sq<Cell>> explosion : explosions0) { 236 .map(Sq::tail)
237 if (!explosion.tail().isEmpty()) { 237 .filter(s -> !s.isEmpty())
238 explosions1.add(explosion.tail()); 238 .collect(Collectors.toList());
239 }
240 }
241 return explosions1;
242 } 239 }
243 240
244 /** 241 /**