Skip to content

Commit 7681058

Browse files
Use foreach
1 parent 2cd69f8 commit 7681058

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

application/src/main/java/org/opentripplanner/updater/trip/gtfs/GtfsRealTimeTripUpdateAdapter.java

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,9 @@ public UpdateResult applyTripUpdates(
125125
snapshotManager.clearBuffer(feedId);
126126
}
127127

128-
for (var i = 0; i < updates.size(); ++i) {
128+
for (var rawTripUpdate : updates) {
129129
Result<UpdateSuccess, UpdateError> result;
130130
try {
131-
var rawTripUpdate = updates.get(i);
132-
133131
if (fuzzyTripMatcher != null) {
134132
var trip = fuzzyTripMatcher.match(feedId, rawTripUpdate.getTrip());
135133
rawTripUpdate = rawTripUpdate.toBuilder().setTrip(trip).build();
@@ -145,10 +143,10 @@ public UpdateResult applyTripUpdates(
145143
}
146144

147145
result = applyUpdate(
148-
forwardsDelayPropagationType,
149-
backwardsDelayPropagationType,
146+
tripUpdate,
150147
updateIncrementality,
151-
tripUpdate
148+
backwardsDelayPropagationType,
149+
forwardsDelayPropagationType
152150
);
153151

154152
if (result.isFailure()) {
@@ -174,10 +172,10 @@ public UpdateResult applyTripUpdates(
174172
}
175173

176174
private Result<UpdateSuccess, UpdateError> applyUpdate(
177-
ForwardsDelayPropagationType forwardsDelayPropagationType,
178-
BackwardsDelayPropagationType backwardsDelayPropagationType,
175+
TripUpdate tripUpdate,
179176
UpdateIncrementality updateIncrementality,
180-
TripUpdate tripUpdate
177+
BackwardsDelayPropagationType backwardsDelayPropagationType,
178+
ForwardsDelayPropagationType forwardsDelayPropagationType
181179
) {
182180
return switch (tripUpdate.scheduleRelationship()) {
183181
case SCHEDULED -> handleScheduledTrip(

0 commit comments

Comments
 (0)