diff options
Diffstat (limited to 'src/main/java/design/model')
| -rw-r--r-- | src/main/java/design/model/ScrambleLeague.java | 9 | ||||
| -rw-r--r-- | src/main/java/design/model/StrokeLeague.java | 9 |
2 files changed, 8 insertions, 10 deletions
diff --git a/src/main/java/design/model/ScrambleLeague.java b/src/main/java/design/model/ScrambleLeague.java index 64f62f5..1765d81 100644 --- a/src/main/java/design/model/ScrambleLeague.java +++ b/src/main/java/design/model/ScrambleLeague.java @@ -13,8 +13,8 @@ import java.util.Map; @JsonTypeName("scramble") public class ScrambleLeague extends League { - private List<Team> participants; - private Map<Team, Integer> totalTeamScores; + private final List<Team> participants; + private final Map<Team, Integer> totalTeamScores; @JsonCreator private ScrambleLeague(int id, String name, Date registrationDate, Date startDate, Date endDate, Golfer owner, List<Team> participants, List<Match> schedule) { @@ -31,9 +31,8 @@ public class ScrambleLeague extends League { } public boolean addParticipants(Team t) { - boolean added = participants.add(t); - if(added) totalTeamScores.putIfAbsent(t, 0); - return added; + totalTeamScores.putIfAbsent(t, 0); + return participants.add(t); } public boolean removeParticipants(Team t) { diff --git a/src/main/java/design/model/StrokeLeague.java b/src/main/java/design/model/StrokeLeague.java index 497db20..57ba1aa 100644 --- a/src/main/java/design/model/StrokeLeague.java +++ b/src/main/java/design/model/StrokeLeague.java @@ -13,8 +13,8 @@ import java.util.Map; @JsonTypeName("stroke") public class StrokeLeague extends League { - private List<Golfer> participants; - private Map<Golfer, Integer> totalStrokes; + private final List<Golfer> participants; + private final Map<Golfer, Integer> totalStrokes; @JsonCreator private StrokeLeague(int id, String name, Date registrationDate, Date startDate, Date endDate, Golfer owner, List<Golfer> participants, List<Match> schedule) { @@ -31,9 +31,8 @@ public class StrokeLeague extends League { } public boolean addParticipants(Golfer g) { - boolean added = participants.add(g); - if(added) totalStrokes.putIfAbsent(g, 0); - return added; + totalStrokes.putIfAbsent(g, 0); + return participants.add(g); } public boolean removeParticipants(Golfer g) { |
