From 4cf14d02eef5e49143c4e350e1d4da80f4d2cd47 Mon Sep 17 00:00:00 2001 From: Johannes Schmelz Date: Sun, 6 Oct 2024 18:33:20 +0200 Subject: [PATCH] reverted commit 35f154aa --- .../model/src/main/java/pp/battleship/model/ShipMap.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) 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); } /**