code: public static Geometry removeHoles(Geometry geometry) {
          if(geometry == null){
              return null;
          }
          if (geometry instanceof Polygon) {
              return removeHolesPolygon((Polygon) geometry);
          } else if (geometry instanceof MultiPolygon) {
              return removeHolesMultiPolygon((MultiPolygon) geometry);
          } else if (geometry instanceof GeometryCollection) {
              Geometry[] geometries = new Geometry[geometry.getNumGeometries()];
              for (int i = 0; i < geometry.getNumGeometries(); i++) {
                  Geometry geom = geometry.getGeometryN(i);
                  if (geometry instanceof Polygon) {
                      geometries[i] = removeHolesPolygon((Polygon) geom);
                  } else if (geometry instanceof MultiPolygon) {
                      geometries[i] = removeHolesMultiPolygon((MultiPolygon) geom);
                  } else {
                      geometries[i] = geom;
                  }
              }
              return FACTORY.createGeometryCollection(geometries);
          }
          return null;
      }
docs: Remove any holes from the geometry. If the geometry doesn't contain any
  holes, return it unchanged.
  
  @param geometry Geometry
  @return Geometry with no holes *