code: public PolylineOptions toPolyline(LineString lineString) {
  
          PolylineOptions polylineOptions = new PolylineOptions();
          Double z = null;
  
          // Try to simplify the number of points in the line string
          List<Point> points = simplifyPoints(lineString.getPoints());
  
          for (Point point : points) {
              LatLng latLng = toLatLng(point);
              polylineOptions.add(latLng);
              if (point.hasZ()) {
                  z = (z == null) ? point.getZ() : Math.max(z, point.getZ());
              }
          }
  
          if (lineString.hasZ() && z != null) {
              polylineOptions.zIndex(z.floatValue());
          }
  
          return polylineOptions;
      }
docs: Convert a {@link LineString} to a {@link PolylineOptions}
  
  @param lineString line string
  @return polyline options