diff options
author | Pacien TRAN-GIRARD | 2016-04-06 22:48:59 +0200 |
---|---|---|
committer | Pacien TRAN-GIRARD | 2016-04-06 22:48:59 +0200 |
commit | 873a3084a9993f9dcf8d575563a6a018ed85dbb6 (patch) | |
tree | af5190f8103dab4b8fd6ff723b77f41e6ebf1778 | |
parent | 0ce2048d2c34efb6335722a8d09c37afca78c583 (diff) | |
download | xblast-873a3084a9993f9dcf8d575563a6a018ed85dbb6.tar.gz |
Optimize nextExplosions
-rw-r--r-- | src/ch/epfl/xblast/server/GameState.java | 11 |
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 | /** |