public class TreeMapBreadthFirstIterator extends java.lang.Object implements java.util.Iterator<TreeMapNode>
Constructor and Description |
---|
TreeMapBreadthFirstIterator(TreeMapNode startNode)
Initialises the iterator with the tree map node at the start of the traversal.
|
Modifier and Type | Method and Description |
---|---|
boolean |
hasNext()
Reports whether or not there are any more elements in the tree that have yet
to be iterated over.
|
TreeMapNode |
next()
Provides the next tree map node in the breadth-first traversal of the hierarchy
or throws a
NoSuchElementException if there are no more nodes to iterate over. |
void |
remove()
Would remove the last returned node from the hierarchy, but does nothing in this case.
|
public TreeMapBreadthFirstIterator(TreeMapNode startNode)
hasNext
is true).startNode
- Parent node from which to iterate over the tree.public boolean hasNext()
hasNext
in interface java.util.Iterator<TreeMapNode>
public TreeMapNode next()
NoSuchElementException
if there are no more nodes to iterate over.next
in interface java.util.Iterator<TreeMapNode>
public void remove()
remove
in interface java.util.Iterator<TreeMapNode>