code: private Set<LineString> nodeLineString(Coordinate[] coords, GeometryFactory gf) {
          MCIndexNoder noder = new MCIndexNoder();
          noder.setSegmentIntersector(new IntersectionAdder(new RobustLineIntersector()));
          List<NodedSegmentString> list = new ArrayList<>();
          list.add(new NodedSegmentString(coords, null));
          noder.computeNodes(list);
          List<LineString> lineStringList = new ArrayList<>();
          for (Object segmentString : noder.getNodedSubstrings()) {
              lineStringList.add(gf.createLineString(
                      ((NodedSegmentString) segmentString).getCoordinates()
              ));
          }
  
          // WARNING : merger loose original linestrings
          // It is useful for LinearRings but should not be used for (Multi)LineStrings
          LineMerger merger = new LineMerger();
          merger.add(lineStringList);
          lineStringList = (List<LineString>) merger.getMergedLineStrings();
  
          // Remove duplicate linestrings preserving main orientation
          Set<LineString> lineStringSet = new HashSet<>();
          for (LineString line : lineStringList) {
              // TODO as equals makes a topological comparison, comparison with line.reverse maybe useless
              if (!lineStringSet.contains(line) && !lineStringSet.contains(line.reverse())) {
                  lineStringSet.add(line);
              }
          }
          return lineStringSet;
      }
docs: Nodes a LineString and returns a List of Noded LineString's. Used to
  repare auto-intersecting LineString and Polygons. This method cannot
  process CoordinateSequence. The noding process is limited to 3d
  geometries.<br/>
  Preserves duplicate coordinates.
  
  @param coords coordinate array to be noded
  @param gf geometryFactory to use
  @return a list of noded LineStrings