E
- the type of elements contained in the treepublic interface TreeNavigator<E>
This interface can be implemented to navigate arbitrary tree-like data structures without requiring them to implement a specific interface.
The navigation relies on child nodes having some fixed order so they can be accessed via an index.
Modifier and Type | Method and Description |
---|---|
Optional<E> |
getChild(E parent,
int childIndex) |
OptionalInt |
getChildIndex(E node) |
int |
getChildrenCount(E parent) |
Optional<E> |
getParent(E child) |
Optional<E> getParent(E child)
child
- an node in the treeempty
is
returnedOptionalInt getChildIndex(E node)
node
- a node in the treeempty
is returnedint getChildrenCount(E parent)
parent
- a node in the treeOptional<E> getChild(E parent, int childIndex)
parent
- a node in the treechildIndex
- a non-negative number specifying the index of the requested childempty
is returnedThis documentation is licensed under CC-BY 4.0, attributed to Nicolai Parlog from CodeFX.