xxl.cursors
Interface PeekIterator

All Known Subinterfaces:
Cursor, Queue

public abstract interface PeekIterator
extends java.util.Iterator

This class extends java.util.Iterator with the peek()-functionality.


Method Summary
 boolean hasNext()
          Returns true if the iteration has more elements.
 java.lang.Object next()
          Returns the next element in the iteration.
 java.lang.Object peek()
          Shows the next element in the iteration without removing it.
 void remove()
          Removes from the underlying collection the last element returned by the iterator (optional operation).
 boolean supportsPeek()
          Returns true if the peek operation is supported by this PeekIterator.
 

Method Detail

hasNext

public boolean hasNext()
Returns true if the iteration has more elements.
Specified by:
hasNext in interface java.util.Iterator
Returns:
true if the iterator has more elements

next

public java.lang.Object next()
                      throws java.util.NoSuchElementException
Returns the next element in the iteration.
Specified by:
next in interface java.util.Iterator
Returns:
the next element in the iteration
Throws:
java.util.NoSuchElementException - iteration has no more elements.

peek

public java.lang.Object peek()
                      throws java.util.NoSuchElementException,
                             java.lang.UnsupportedOperationException
Shows the next element in the iteration without removing it.
Returns:
the next element in the iteration
Throws:
java.util.NoSuchElementException - iteration has no more elements.
java.lang.UnsupportedOperationException - if the peek operation is not supported by this PeekIterator.

remove

public void remove()
            throws java.lang.IllegalStateException,
                   java.lang.UnsupportedOperationException
Removes from the underlying collection the last element returned by the iterator (optional operation).
Specified by:
remove in interface java.util.Iterator
Throws:
java.lang.IllegalStateException - if the next method has not yet been called, or the remove method has already been called after the last call to the next method.
java.lang.UnsupportedOperationException - if the remove operation is not supported by this PeekIterator.

supportsPeek

public boolean supportsPeek()
Returns true if the peek operation is supported by this PeekIterator.
Returns:
true if the peek operation is supported by this PeekIterator