code: public static List<Geometry> flatFeatureList(Geometry geom) {
          final List<Geometry> singleGeoms = new ArrayList<>();
          final Stack<Geometry> geomStack = new Stack<>();
  
          Geometry nextGeom;
          int nextGeomCount;
  
          geomStack.push(geom);
          while(!geomStack.isEmpty()) {
              nextGeom = geomStack.pop();
  
              if(nextGeom instanceof Point
                      || nextGeom instanceof MultiPoint
                      || nextGeom instanceof LineString
                      || nextGeom instanceof MultiLineString
                      || nextGeom instanceof Polygon
                      || nextGeom instanceof MultiPolygon) {
  
                  singleGeoms.add(nextGeom);
  
              } else if(nextGeom instanceof GeometryCollection) {
  
                  // Push all child geometries
                  nextGeomCount = nextGeom.getNumGeometries();
                  for(int i = 0; i < nextGeomCount; ++i) {
                      geomStack.push(nextGeom.getGeometryN(i));
                  }
  
              }
          }
  
          return singleGeoms;
      }
docs: <p>Recursively convert a {@link Geometry}, which may be an instance of {@link GeometryCollection} with mixed
  element types, into a flat list containing only the following {@link Geometry} types:</p>
  <ul>
  <li>{@link Point}</li>
  <li>{@link LineString}</li>
  <li>{@link Polygon}</li>
  <li>{@link MultiPoint}</li>
  <li>{@link MultiLineString}</li>
  <li>{@link MultiPolygon}</li>
  </ul>
  <p>WARNING: Any other Geometry types that were not mentioned in the list above will be discarded!</p>
  <p>Useful for converting a generic geometry into a list of simple MVT-feature-ready geometries.</p>
  
  @param geom geometry to flatten
  @return list of MVT-feature-ready geometries