diff --git a/app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/Tournament.java b/app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/Tournament.java index 1ff76fd..e267156 100644 --- a/app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/Tournament.java +++ b/app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/Tournament.java @@ -110,7 +110,11 @@ public class Tournament implements Serializable { * @throws PlaceExistsException if the place already exists */ public void addPlace(Place newPlace) throws PlaceExistsException { - places.removeIf(place -> place.equals(newPlace)); + for(Place place : places){ + if(place.getName().equals(newPlace.getName())){ + throw new PlaceExistsException("Place with same name exists already."); + } + } places.add(newPlace); }