Package com.google.common.collect
Class BinaryTreeTraverser.PreOrderIterator
- java.lang.Object
-
- com.google.common.collect.UnmodifiableIterator<T>
-
- com.google.common.collect.BinaryTreeTraverser.PreOrderIterator
-
- All Implemented Interfaces:
PeekingIterator<T>
,java.util.Iterator<T>
- Enclosing class:
- BinaryTreeTraverser<T>
private final class BinaryTreeTraverser.PreOrderIterator extends UnmodifiableIterator<T> implements PeekingIterator<T>
-
-
Constructor Summary
Constructors Constructor Description PreOrderIterator(T root)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
hasNext()
T
next()
T
peek()
Returns the next element in the iteration, without advancing the iteration.-
Methods inherited from class com.google.common.collect.UnmodifiableIterator
remove
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.google.common.collect.PeekingIterator
remove
-
-
-
-
Field Detail
-
stack
private final java.util.Deque<T> stack
-
-
Constructor Detail
-
PreOrderIterator
PreOrderIterator(T root)
-
-
Method Detail
-
hasNext
public boolean hasNext()
- Specified by:
hasNext
in interfacejava.util.Iterator<T>
-
next
public T next()
Description copied from interface:PeekingIterator
The objects returned by consecutive calls to
PeekingIterator.peek()
thenPeekingIterator.next()
are guaranteed to be equal to each other.- Specified by:
next
in interfacejava.util.Iterator<T>
- Specified by:
next
in interfacePeekingIterator<T>
-
peek
public T peek()
Description copied from interface:PeekingIterator
Returns the next element in the iteration, without advancing the iteration.Calls to
peek()
should not change the state of the iteration, except that it may prevent removal of the most recent element viaPeekingIterator.remove()
.- Specified by:
peek
in interfacePeekingIterator<T>
-
-