code: public static GeometryCollection createDT(Geometry geometry, int flag) throws SQLException {
          if (geometry != null) {
              DelaunayTriangulationBuilder triangulationBuilder = new DelaunayTriangulationBuilder();
              triangulationBuilder.setSites(geometry);
              if(flag == 0) {
                  return getTriangles(geometry.getFactory(), triangulationBuilder);
              } else {
                  return (GeometryCollection)triangulationBuilder.getEdges(geometry.getFactory());
              }
          }
          return null;
      }
docs: Build a delaunay triangulation based on all coordinates of the geometry
  
  @param geometry
  @param flag  for flag=0 (default flag) or a MULTILINESTRING for flag=1
  @return a set of polygons (triangles)
  @throws SQLException