diff --git a/Projekte/battleship/model/src/main/java/pp/battleship/model/ShipMap.java b/Projekte/battleship/model/src/main/java/pp/battleship/model/ShipMap.java index 3bd5c20..5a16278 100644 --- a/Projekte/battleship/model/src/main/java/pp/battleship/model/ShipMap.java +++ b/Projekte/battleship/model/src/main/java/pp/battleship/model/ShipMap.java @@ -105,9 +105,7 @@ public class ShipMap { * Removes all items from the map and triggers corresponding removal events for each. */ public void clear() { - while (!items.isEmpty()) { - notifyListeners(new ItemRemovedEvent(items.removeFirst(), this)); - } + new ArrayList<>(items).forEach(this::remove); } /**