public interface IterableTreeNode<O> extends TreeNode, Iterable<IterableTreeNode<?>>
TreeNode implementation that is mutable, but does not implements MutableTreeNode,
because this API has some lacks:
VectorIterable to get nice access to children nodes using modern API. In that way
we can perform nice and efficient traversal algorithms using exclusively Stream API.
Created by tchemit on 07/01/2018.
| Modifier and Type | Interface and Description |
|---|---|
static class |
IterableTreeNode.BreadthFirstIterator |
static class |
IterableTreeNode.PostorderIterator |
static class |
IterableTreeNode.PreorderIterator |
| Modifier and Type | Field and Description |
|---|---|
static Iterator<IterableTreeNode<?>> |
EMPTY_ITERATOR |
static int |
STREAM_CHARACTERISTICS |
children, getAllowsChildren, getChildAt, getChildCount, getIndex, isLeafforEach, iterator, spliteratorstatic final Iterator<IterableTreeNode<?>> EMPTY_ITERATOR
static final int STREAM_CHARACTERISTICS
static Stream<IterableTreeNode<?>> stream(Iterator<IterableTreeNode<?>> iterator)
default Stream<IterableTreeNode<?>> stream()
boolean isRoot()
IterableTreeNode<?> getRoot()
IterableTreeNode<?> getParent()
void setParent(IterableTreeNode<?> parent)
void setAllowsChildren(boolean allowsChildren)
boolean isEmpty()
O getUserObject()
void setUserObject(O userObject)
void addChild(IterableTreeNode<?> newChild)
void insertChild(IterableTreeNode<?> newChild, int position)
void removeChild(int index)
index.
Will throw exception if no child at index.
index - position of child to removevoid removeChild(IterableTreeNode<?> child)
child.
Will throw exception if given child is not a child of this node.
child - child to removevoid removeChildren()
void removeChildren(List<IterableTreeNode<?>> children)
removeChild(IterableTreeNode) for each element.children - children to removedefault Iterator<IterableTreeNode<?>> preorderIterator()
default Iterator<IterableTreeNode<?>> postorderIterator()
default Iterator<IterableTreeNode<?>> breadthFirstIterator()
Copyright © 2008–2018 Ultreia.io. All rights reserved.