Merge pull request #20 from PM2-IT21bWIN-ruiz-mach-krea/fix_participanFormular_and_placesFormular

fixed participanFormular and placesFormular
This commit is contained in:
fassband 2022-05-06 10:09:47 +02:00 committed by GitHub Enterprise
commit 9bf6038ec1
1 changed files with 3 additions and 10 deletions

View File

@ -7,6 +7,7 @@ import java.io.File;
import java.io.Serializable; import java.io.Serializable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Iterator;
import java.util.List; import java.util.List;
public class Tournament implements Serializable { public class Tournament implements Serializable {
@ -31,11 +32,7 @@ public class Tournament implements Serializable {
} }
public void addParticipant(Participant newParticipant) throws ParticipantExistsException { public void addParticipant(Participant newParticipant) throws ParticipantExistsException {
for(Participant participant : participants){ participants.removeIf(participant -> participant.equals(newParticipant));
if(participant.equals(newParticipant)){
participants.remove(participant);
}
}
participants.add(newParticipant); participants.add(newParticipant);
} }
@ -53,11 +50,7 @@ public class Tournament implements Serializable {
} }
public void addPlace(Place newPlace) throws PlaceExistsException { public void addPlace(Place newPlace) throws PlaceExistsException {
for(Place place : places){ places.removeIf(place -> place.equals(newPlace));
if(place.equals(newPlace)){
places.remove(place);
}
}
places.add(newPlace); places.add(newPlace);
} }