Develop footer #51

Merged
schrom01 merged 5 commits from develop_footer into main 2022-05-13 17:52:45 +02:00
1 changed files with 5 additions and 1 deletions
Showing only changes of commit 54a428cde2 - Show all commits

View File

@ -110,7 +110,11 @@ public class Tournament implements Serializable {
* @throws PlaceExistsException if the place already exists * @throws PlaceExistsException if the place already exists
*/ */
public void addPlace(Place newPlace) throws PlaceExistsException { 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); places.add(newPlace);
} }