Package generic.util
Class WrappingPeekableIterator<T>
- java.lang.Object
-
- generic.util.WrappingPeekableIterator<T>
-
- Type Parameters:
T- the type of the iterator
- All Implemented Interfaces:
PeekableIterator<T>,java.util.Iterator<T>
public class WrappingPeekableIterator<T> extends java.lang.Object implements PeekableIterator<T>
An implementation ofPeekableIteratorthat can take a JavaIteratorand wrap it to implement thePeekableIteratorinterface.
-
-
Constructor Summary
Constructors Constructor Description WrappingPeekableIterator(java.util.Iterator<T> iterator)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanhasNext()Tnext()Tpeek()Returns the item that would be returned by callingIterator.next(), but does not increment the iterator asnextwould.voidremove()
-
-
-
Constructor Detail
-
WrappingPeekableIterator
public WrappingPeekableIterator(java.util.Iterator<T> iterator)
-
-
Method Detail
-
hasNext
public boolean hasNext()
- Specified by:
hasNextin interfacejava.util.Iterator<T>
-
remove
public void remove()
- Specified by:
removein interfacejava.util.Iterator<T>
-
peek
public T peek() throws java.util.NoSuchElementException
Description copied from interface:PeekableIteratorReturns the item that would be returned by callingIterator.next(), but does not increment the iterator asnextwould.- Specified by:
peekin interfacePeekableIterator<T>- Returns:
- the item that would be returned by calling
Iterator.next() - Throws:
java.util.NoSuchElementException
-
-