aboutsummaryrefslogtreecommitdiff
path: root/src/ch
diff options
context:
space:
mode:
authorPacien TRAN-GIRARD2016-04-08 19:20:18 +0200
committerPacien TRAN-GIRARD2016-04-08 19:20:18 +0200
commite3f8e4276d87f2dba10395a882dc4673b65b4e89 (patch)
treea8284a606a1ebdfca24cfca2e27708c5c4559590 /src/ch
parent5d8e8c6e0430d004162cb02229a55ab5ae7dee05 (diff)
downloadxblast-e3f8e4276d87f2dba10395a882dc4673b65b4e89.tar.gz
Use stream for explosion generation
Diffstat (limited to 'src/ch')
-rw-r--r--src/ch/epfl/xblast/server/Bomb.java11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/ch/epfl/xblast/server/Bomb.java b/src/ch/epfl/xblast/server/Bomb.java
index 3b1203b..f32960f 100644
--- a/src/ch/epfl/xblast/server/Bomb.java
+++ b/src/ch/epfl/xblast/server/Bomb.java
@@ -6,9 +6,10 @@ import ch.epfl.xblast.Cell;
6import ch.epfl.xblast.Direction; 6import ch.epfl.xblast.Direction;
7import ch.epfl.xblast.PlayerID; 7import ch.epfl.xblast.PlayerID;
8 8
9import java.util.ArrayList;
10import java.util.List; 9import java.util.List;
11import java.util.Objects; 10import java.util.Objects;
11import java.util.stream.Collectors;
12import java.util.stream.Stream;
12 13
13/** 14/**
14 * A Bomb. 15 * A Bomb.
@@ -106,11 +107,9 @@ public final class Bomb {
106 * @return the explosion 107 * @return the explosion
107 */ 108 */
108 public List<Sq<Sq<Cell>>> explosion() { 109 public List<Sq<Sq<Cell>>> explosion() {
109 List<Sq<Sq<Cell>>> explosion = new ArrayList<>(); 110 return Stream.of(Direction.values())
110 for (Direction dir : Direction.values()) { 111 .map(this::explosionArmTowards)
111 explosion.add(this.explosionArmTowards(dir)); 112 .collect(Collectors.toList());
112 }
113 return explosion;
114 } 113 }
115 114
116} 115}