|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.levigo.util.base.collections.PeekableIteratorWrapper<T>
T
- The type of the Iterator (has to be the same as the Iterator
given into the
PeekableIterator
constructor)public class PeekableIteratorWrapper<T>
This implementation wraps another Iterator
and provides the peeking functionality
Constructor Summary | |
---|---|
PeekableIteratorWrapper(Iterator<T> rootIter)
|
Method Summary | |
---|---|
boolean |
hasNext()
|
T |
next()
|
T |
peek()
Peeks the very next element. |
void |
remove()
removal of elements is not supported. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PeekableIteratorWrapper(Iterator<T> rootIter)
Method Detail |
---|
public boolean hasNext()
PeekableIterator
hasNext
in interface PeekableIterator<T>
hasNext
in interface Iterator<T>
public T next()
PeekableIterator
next
in interface PeekableIterator<T>
next
in interface Iterator<T>
public T peek()
PeekableIterator
Iterator.next()
would
return, with the addition that it will not be consumed directly. The
implementation ensures that the following statement will return true:
peekableIter.peek() == peekableIter.next();
peek
in interface PeekableIterator<T>
public void remove()
UnsupportedOperationException
remove
in interface PeekableIterator<T>
remove
in interface Iterator<T>
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |