@@ -21,13 +21,11 @@ public class HorseTransportMode implements ITransportMode {
2121 @ Override
2222 public boolean canTraverseWay (@ NotNull final IWay <?> way , @ NotNull final WayTraversalDirection direction ) {
2323 final String onewayValue = way .get ("oneway" );
24- List <String > majorHighways = Arrays .asList (
25- "tertiary" , "secondary" , "primary" , "trunk" );
26- majorHighways .forEach (v -> majorHighways .add (String .format ("%s_link" , v )));
27- // This list is ordered from most suitable to least suitable
28- List <String > suitableHighwaysForHorseRiders = Arrays .asList (
29- "bridleway" , "pedestrian" , "footway" , "path" , "track" , "living_street" , "residential" , "unclassified" , "cyclestreet" , "service" , "cycleway" );
30- suitableHighwaysForHorseRiders .addAll (majorHighways ); // TODO do this only once when plugin starts
24+ final List <String > suitableHighwaysForHorseRiders = Stream .concat (
25+ // This list is ordered from most suitable to least suitable
26+ Stream .of ("bridleway" , "pedestrian" , "footway" , "path" , "track" , "living_street" , "residential" , "unclassified" , "cyclestreet" , "service" , "cycleway" ),
27+ Stream .of ("tertiary" , "secondary" , "primary" , "trunk" ).flatMap (it -> Stream .of (it , it + "_link" ))
28+ ).collect (Collectors .toList ());
3129 return !way .hasTag ("horse" , "no" ) &&
3230 (way .hasTag ("highway" , suitableHighwaysForHorseRiders ) ||
3331 way .hasTag ("horse" , "yes" ))
0 commit comments