private final class TreeTraverser.BreadthFirstIterator extends UnmodifiableIterator<T> implements PeekingIterator<T>
Constructor and Description |
---|
BreadthFirstIterator(T root) |
Modifier and Type | Method and Description |
---|---|
boolean |
hasNext() |
T |
next() |
T |
peek()
Returns the next element in the iteration, without advancing the iteration.
|
remove
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
remove
private final java.util.Queue<T> queue
BreadthFirstIterator(T root)
public boolean hasNext()
hasNext
in interface java.util.Iterator<T>
public T peek()
PeekingIterator
Calls to peek()
should not change the state of the iteration, except that it
may prevent removal of the most recent element via PeekingIterator.remove()
.
peek
in interface PeekingIterator<T>
public T next()
PeekingIterator
The objects returned by consecutive calls to PeekingIterator.peek()
then PeekingIterator.next()
are
guaranteed to be equal to each other.
next
in interface PeekingIterator<T>
next
in interface java.util.Iterator<T>