mirror of
https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02.git
synced 2024-11-28 18:59:47 +01:00
fixed clear
This commit is contained in:
parent
4488911e82
commit
35f154aa0f
@ -10,6 +10,7 @@ package pp.battleship.model;
|
||||
import pp.battleship.notification.GameEvent;
|
||||
import pp.battleship.notification.GameEventBroker;
|
||||
import pp.battleship.notification.ItemAddedEvent;
|
||||
import pp.battleship.notification.ItemRemovedEvent;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
@ -104,7 +105,10 @@ public class ShipMap {
|
||||
* Removes all items from the map and triggers corresponding removal events for each.
|
||||
*/
|
||||
public void clear() {
|
||||
new ArrayList<>(items).forEach(this::remove);
|
||||
for (Item item : items) {
|
||||
items.remove(item);
|
||||
notifyListeners(new ItemRemovedEvent(item, this));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user