code: public MultiPolygon createMultiPolygon(List<Polygon> polygonList,
                                             boolean hasZ, boolean hasM) {
  
          MultiPolygon multiPolygon = new MultiPolygon(hasZ, hasM);
  
          for (Polygon polygon : polygonList) {
              multiPolygon.addPolygon(polygon);
          }
  
          return multiPolygon;
      }
docs: Convert a list of {@link Polygon} to a {@link MultiPolygon}
  
  @param polygonList polygon list
  @param hasZ        has z flag
  @param hasM        has m flag
  @return multi polygon