Skip to content

Commit

Permalink
Make collection handling more consistent
Browse files Browse the repository at this point in the history
  • Loading branch information
leonardehrenfried committed Jan 20, 2025
1 parent 2d7c8bc commit 3c68f37
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Objects;
import java.util.OptionalDouble;
Expand Down Expand Up @@ -172,8 +173,8 @@ public Float accessibilityScore() {
return accessibilityScore;
}

public B withAlerts(Collection<TransitAlert> alerts) {
this.alerts = Set.copyOf(alerts);
public B withAlerts(Set<TransitAlert> alerts) {
this.alerts = Objects.requireNonNull(alerts);
return instance();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public TransitLeg copyLegWithAlerts(TransitLeg leg, boolean isFirstLeg) {
FeedScopedId tripId = leg.getTrip().getId();
LocalDate serviceDate = leg.getServiceDate();

var totalAlerts = new ArrayList<TransitAlert>();
var totalAlerts = new HashSet<TransitAlert>();

if (fromStop instanceof RegularStop stop) {
Set<StopCondition> stopConditions = isFirstLeg
Expand Down

0 comments on commit 3c68f37

Please sign in to comment.