code: public static GeometryCollection removeCoordinates(GeometryCollection g) {
          ArrayList<Geometry> geoms = new ArrayList<Geometry>();
          for (int i = 0; i < g.getNumGeometries(); i++) {
              Geometry geom = g.getGeometryN(i);
              geoms.add(removeCoordinates(geom));
          }
          return FACTORY.createGeometryCollection(GeometryFactory.toGeometryArray(geoms));
      }
docs: Removes duplicated coordinates within a GeometryCollection
  
  @param g
  @return