public List<Integer> replaceCloseWithLine(){
  List<Integer> modifiedSubpathsIndices=new ArrayList<>();
  int i=0;
  for (  Subpath subpath : subpaths) {
    if (subpath.isClosed()) {
      subpath.setClosed(false);
      subpath.addSegment(new Line(subpath.getLastPoint(),subpath.getStartPoint()));
      modifiedSubpathsIndices.add(i);
    }
    ++i;
  }
  return modifiedSubpathsIndices;
}

public List < Integer > replaceCloseWithLine ( ) { List < Integer > modifiedSubpathsIndices = new ArrayList < > ( ) ; int i = 0 ; for ( Subpath subpath : subpaths ) { if ( subpath . isClosed ( ) ) { subpath . setClosed ( false ) ; subpath . addSegment ( new Line ( subpath . getLastPoint ( ) , subpath . getStartPoint ( ) ) ) ; modifiedSubpathsIndices . add ( i ) ; } ++ i ; } return modifiedSubpathsIndices ; }
adds additional line to each closed subpath and makes the subpath unclosed . the line connects the last and the first points of the subpaths .
