public class PeekableIterator<Object> extends Object implements CloseableIterator<Object>
Constructor and Description |
---|
PeekableIterator(Iterator<Object> iterator)
Constructs a new iterator that wraps the supplied iterator.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the underlying iterator.
|
boolean |
hasNext()
True if there are more items, in which case both next() and peek() will return a value.
|
Object |
next()
Returns the next object and advances the iterator.
|
Object |
peek()
Returns the next object but does not advance the iterator.
|
void |
remove()
Unsupported Operation.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEachRemaining
public void close()
close
in interface CloseableIterator<Object>
close
in interface Closeable
close
in interface AutoCloseable
public boolean hasNext()
public Object next()
public Object peek()