edu.wisc.cs.util
Interface PeekIterator
- public interface PeekIterator
- extends java.util.Iterator
This interface extends the java.util.Iterator
, adding a method
to peek at the next element.
Method Summary |
java.lang.Object |
peek()
Returns the next object in the iterator, but does move past it. |
Methods inherited from interface java.util.Iterator |
hasNext,
next,
remove |
peek
public java.lang.Object peek()
- Returns the next object in the iterator, but does move past it.
This method should behave exactly as the
next
method, but
does not move past the element returned in the iterator.
- Returns:
- the next object in the iterator.
- Throws:
- NoSuchElementException - if there is are no elements in the iterator.