docs: public static void addMarkerAsPolyline(Marker marker, List<Marker> markers) {
          GeoPoint position = marker.getPosition();
          int insertLocation = markers.size();
          if (markers.size() > 1) {
              double[] distances = new double[markers.size()];
              insertLocation = 0;
              distances[0] = SphericalUtil.computeDistanceBetween(position,
                      markers.get(0).getPosition());
              for (int i = 1; i < markers.size(); i++) {
                  distances[i] = SphericalUtil.computeDistanceBetween(position,
                          markers.get(i).getPosition());
                  if (distances[i] < distances[insertLocation]) {
                      insertLocation = i;
                  }
              }
  
              Integer beforeLocation = insertLocation > 0 ? insertLocation - 1
                      : null;
              Integer afterLocation = insertLocation < distances.length - 1 ? insertLocation + 1
                      : null;
  
              if (beforeLocation != null && afterLocation != null) {
                  if (distances[beforeLocation] > distances[afterLocation]) {
                      insertLocation = afterLocation;
                  }
              } else if (beforeLocation != null) {
                  if (distances[beforeLocation] >= SphericalUtil
                          .computeDistanceBetween(markers.get(beforeLocation)
                                  .getPosition(), markers.get(insertLocation)
                                  .getPosition())) {
                      insertLocation++;
                  }
              } else {
                  if (distances[afterLocation] < SphericalUtil
                          .computeDistanceBetween(markers.get(afterLocation)
                                  .getPosition(), markers.get(insertLocation)
                                  .getPosition())) {
                      insertLocation++;
                  }
              }
  
          }
          markers.add(insertLocation, marker);
      }