public abstract class IlvBreadthFirstIterator<E> extends Object implements Iterator<E>
IlvBreadthFirstIterator
is an abstract class that provides
traversal over a generic tree structure of objects in breadth first order.
Concrete subclasses must simply provide an implementation of
getChildren
that properly accounts for the type of nodes being
traversed.Constructor and Description |
---|
IlvBreadthFirstIterator(E root)
Construct a new
IlvBreadthFirstIterator that starts traversing
the subtree of objects that descends from the specified root . |
Modifier and Type | Method and Description |
---|---|
protected abstract Iterator<E> |
getChildren(E parent)
Return an iterator over the child nodes of the specified parent object.
|
boolean |
hasNext()
Return whether the iteration has more elements.
|
E |
next()
Return the next element in the iteration.
|
void |
remove()
Remove from the underlying collection the last object returned by the
iterator.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEachRemaining
public IlvBreadthFirstIterator(E root)
IlvBreadthFirstIterator
that starts traversing
the subtree of objects that descends from the specified root
.protected abstract Iterator<E> getChildren(E parent)
public boolean hasNext()
true
if next()
would return an element
rather than throwing an exception.)public E next()
next
in interface Iterator<E>
NoSuchElementException
- if the iteration has no more elements.© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.