diff --git a/src/main/java/org/openstreetmap/josm/plugins/pt_assistant/actions/routinghelper/HorseTransportMode.java b/src/main/java/org/openstreetmap/josm/plugins/pt_assistant/actions/routinghelper/HorseTransportMode.java index f6928738..dd559882 100644 --- a/src/main/java/org/openstreetmap/josm/plugins/pt_assistant/actions/routinghelper/HorseTransportMode.java +++ b/src/main/java/org/openstreetmap/josm/plugins/pt_assistant/actions/routinghelper/HorseTransportMode.java @@ -21,13 +21,11 @@ public class HorseTransportMode implements ITransportMode { @Override public boolean canTraverseWay(@NotNull final IWay way, @NotNull final WayTraversalDirection direction) { final String onewayValue = way.get("oneway"); - List majorHighways = Arrays.asList( - "tertiary", "secondary", "primary", "trunk"); - majorHighways.forEach(v -> majorHighways.add(String.format("%s_link", v))); - // This list is ordered from most suitable to least suitable - List suitableHighwaysForHorseRiders = Arrays.asList( - "bridleway", "pedestrian", "footway", "path", "track", "living_street", "residential", "unclassified", "cyclestreet", "service", "cycleway"); - suitableHighwaysForHorseRiders.addAll(majorHighways); // TODO do this only once when plugin starts + final List suitableHighwaysForHorseRiders = Stream.concat( + // This list is ordered from most suitable to least suitable + Stream.of("bridleway", "pedestrian", "footway", "path", "track", "living_street", "residential", "unclassified", "cyclestreet", "service", "cycleway"), + Stream.of("tertiary", "secondary", "primary", "trunk").flatMap(it -> Stream.of(it, it + "_link")) + ).collect(Collectors.toList()); return !way.hasTag("horse", "no") && (way.hasTag("highway", suitableHighwaysForHorseRiders) || way.hasTag("horse", "yes"))