// TODO: This should be streaming instead of creating an entire collection public LineFile print(PackageFileSystem<A> fs) { LineFile lines = new LineFile(); Tree<PackageFileSystemObject<A>> tree = fs.prettify().getTree(); lines.add("."); print(1, lines, tree.subForest()._1()); return lines; }
private void print(int i, LineFile lines, Stream<Tree<PackageFileSystemObject<A>>> children) { String indent = StringUtils.repeat(" ", i); i++; for (Tree<PackageFileSystemObject<A>> child : children) { // UnixFsObject unixFsObject = child.root().getUnixFsObject(); // lines.add( indent + unixFsObject.path.name() + ", filters=" + // unixFsObject.filters ); lines.add(indent + child.root().getUnixFsObject().path.name()); print(i, lines, child.subForest()._1()); } }