code: private static Polygon processPolygon(Polygon p, Geometry triangleLines, GeometryFactory factory) {
          Geometry diffExt = p.getExteriorRing().difference(triangleLines);
          final int nbOfHoles = p.getNumInteriorRing();
          final LinearRing[] holes = new LinearRing[nbOfHoles];
          for (int i = 0; i < nbOfHoles; i++) {
              holes[i] = factory.createLinearRing(lineMerge(p.getInteriorRingN(i).difference(triangleLines), factory).getCoordinates());
          }
          return factory.createPolygon(factory.createLinearRing(lineMerge(diffExt, factory).getCoordinates()), holes);
  
      }
docs: Cut the lines of the polygon with the triangles
  @param p
  @param triangleLines
  @param factory
  @return