diff --git a/src/ext/java/org/opentripplanner/ext/transmodelapi/model/stop/StopPlaceType.java b/src/ext/java/org/opentripplanner/ext/transmodelapi/model/stop/StopPlaceType.java index cb10b6e43c3..c95d7e15c0f 100644 --- a/src/ext/java/org/opentripplanner/ext/transmodelapi/model/stop/StopPlaceType.java +++ b/src/ext/java/org/opentripplanner/ext/transmodelapi/model/stop/StopPlaceType.java @@ -361,14 +361,19 @@ else if("all".equals(multiModalMode)) { }); return result; } - // Default "parent" - Multi modal parent stop places without their mono modal children + // Default "parent" - Multi modal parent stop places without their mono modal children, but add + // mono modal stop places if they have no parent stop place else if("parent".equals(multiModalMode)){ - return stations - .map(it -> routingService.getMultiModalStationForStations().get(it)) - .filter(Objects::nonNull) - .distinct() - .map(MonoOrMultiModalStation::new) - .collect(Collectors.toUnmodifiableList()); + Set result = new HashSet<>(); + stations.forEach(it -> { + MultiModalStation p = routingService.getMultiModalStationForStations().get(it); + if(p != null) { + result.add(new MonoOrMultiModalStation(p)); + } else { + result.add(new MonoOrMultiModalStation(it, null)); + } + }); + return result; } else { throw new IllegalArgumentException("Unexpected multiModalMode: " + multiModalMode);