TreePath

Provides an unambiguous way to address nodes by position within a tree-structure. Examples:

  • /0 …​ the tree root

  • /0/1 …​ the second child of root

  • /0/0/0 …​ the first child of first child of root

API

TreePath.java
interface TreePath {
  TreePath append(int indexWithinSiblings)     (1)
  TreePath getParentIfAny()     (2)
  boolean isRoot()
  IntStream streamPathElements()
  String stringify(String delimiter)
  Stream<TreePath> streamUpTheHierarchyStartingAtSelf()
  TreePath of(int... canonicalPath)
  TreePath root()
  TreePath parse(String treePathStringified, String delimiter)     (3)
}
1 append(int)
2 getParentIfAny()

Returns a TreePath instance that represents the parent path of this TreePath, if this is not the root.

3 parse(String, String)

Parses stringified tree path of format 031 …​, as returned by TreePath#stringify(String) .

Members

append(int)

getParentIfAny()

Returns a TreePath instance that represents the parent path of this TreePath, if this is not the root.

parse(String, String)

Parses stringified tree path of format 031 …​, as returned by TreePath#stringify(String) .

For null or empty input the root is returned.