code: public static GeometryCollection removeDuplicateCoordinates(GeometryCollection geometryCollection, double tolerance) throws SQLException {
          ArrayList<Geometry> geoms = new ArrayList<>();
          for (int i = 0; i < geometryCollection.getNumGeometries(); i++) {
              Geometry geom = geometryCollection.getGeometryN(i);
              geoms.add(removeDuplicateCoordinates(geom, tolerance));
          }
          return FACTORY.createGeometryCollection(GeometryFactory.toGeometryArray(geoms));
      }
docs: Removes duplicated coordinates within a GeometryCollection
  
  @param geometryCollection
  @param tolerance to delete the coordinates
  @return
  @throws java.sql.SQLException