Develop footer #51
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue