title: Java How to set new coordinates to a geometry in 2D
body: <p>I have some geometry in 3D and I woudlike to return a geometry in 2D (dimension 2) with new coordinates :</p>
  <pre><code>private static Geometry convert2D(Geometry g3D) {
          // copy geometry
          Geometry g2D = (Geometry) g3D.clone();
          Geometry geometry;
          // set new 2D coordinates
          for (Coordinate c : g2D.getCoordinates()) {
              c.setCoordinate(new Coordinate(c.x, c.y));
          }
  
          // SET NEW COORDINATES TO g2D 
          
          return g2D;
      }
  </code></pre>
  <p>How can I do that with because the object geometry don't have the method <code>setCoordinates</code> ?</p>