Java Reference
In-Depth Information
public boolean hasNext()
Returns true if there is a suitable element for next() to return; returns false otherwise.
public boolean hasPrevious()
Returns true if there is a suitable element for previous() to return; returns false otherwise.
public int nextIndex()
Returns the index of the element that would be returned by a call to next() . Returns the list
size if the cursor position is at the end of the list.
public T next()
Returns the next element of the list that produced the iterator. More specifi cally, returns the
element immediately after the cursor position.
Throws:
NoSuchElementException if there is no next element.
public T previous()
Returns the previous element of the list that produced the iterator. More specifi cally, returns the
element immediately before the cursor position.
Throws:
NoSuchElementException if there is no previous element.
public int previousIndex()
Returns the index that would be returned by a call to previous() . Returns −1 if the cursor
position is at the beginning of the list.
public void remove() ( Optional )
Removes from the collection the last element returned by next() or previous() .
This method can be called only once per call to next() or previous() .
Cannot be used if there has been a call to add or remove since the last call to next()
or previous() .
Throws:
IllegalStateException if neither next() nor previous() has been called, or the add or
remove method has already been called after the last call to next() or previous() .
UnsupportedOperationException if the remove operation is not supported by
this Iterator .
Search WWH ::




Custom Search