protected Map<Node, Way> getWayEndNodesNearOtherHighway() {
   Map<Node, Way> map = new HashMap<>();
   for (int iter = 0; iter < 1; iter++) {
     for (MyWaySegment s : ways) {
       if (isCanceled()) {
         map.clear();
         return map;
       }
       for (Node en : s.nearbyNodes(mindist)) {
         if (en == null || !s.highway || !endnodesHighway.contains(en)) {
           continue;
         }
         if (en.hasTag("highway", "turning_circle", "bus_stop")
             || en.hasTag("amenity", "parking_entrance")
             || en.hasTag("railway", "buffer_stop")
             || en.isKeyTrue("noexit")
             || en.hasKey("entrance")
             || en.hasKey("barrier")) {
           continue;
         }
         // to handle intersections of 't' shapes and similar
         if (en.isConnectedTo(s.w.getNodes(), 3 /* hops */, null)) {
           continue;
         }
         map.put(en, s.w);
       }
     }
   }
   return map;
 }
 protected Map<Node, Way> getConnectedWayEndNodesNearOtherWay() {
   Map<Node, Way> map = new HashMap<>();
   for (MyWaySegment s : ways) {
     if (isCanceled()) {
       map.clear();
       return map;
     }
     for (Node en : s.nearbyNodes(minmiddledist)) {
       if (en.isConnectedTo(s.w.getNodes(), 3 /* hops */, null)) {
         continue;
       }
       if (!othernodes.contains(en)) {
         continue;
       }
       map.put(en, s.w);
     }
   }
   return map;
 }
 protected Map<Node, Way> getWayEndNodesNearOtherWay() {
   Map<Node, Way> map = new HashMap<>();
   for (MyWaySegment s : ways) {
     if (isCanceled()) {
       map.clear();
       return map;
     }
     for (Node en : s.nearbyNodes(mindist)) {
       if (en.isConnectedTo(s.w.getNodes(), 3 /* hops */, null)) {
         continue;
       }
       if (endnodesHighway.contains(en) && !s.highway && !s.w.concernsArea()) {
         map.put(en, s.w);
       } else if (endnodes.contains(en) && !s.w.concernsArea()) {
         map.put(en, s.w);
       }
     }
   }
   return map;
 }