|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Iterator
An object which iterates over a collection. An Iterator is used to return the items once only, in sequence, by successive calls to the next method. It is also possible to remove elements from the underlying collection by using the optional remove method. Iterator is intended as a replacement for the Enumeration interface of previous versions of Java, which did not have the remove method and had less conveniently named methods.
Collection
,
ListIterator
,
Enumeration
Method Summary | |
---|---|
boolean |
hasNext()
Tests whether there are elements remaining in the collection. |
Object |
next()
Obtain the next element in the collection. |
void |
remove()
Remove from the underlying collection the last element returned by next (optional operation). |
Method Detail |
---|
boolean hasNext()
next()
will not throw an exception.
Object next()
NoSuchElementException
- if there are no more elementsvoid remove()
next()
. It does not affect what will be returned
by subsequent calls to next.
IllegalStateException
- if next has not yet been called or remove
has already been called since the last call to next.
UnsupportedOperationException
- if this Iterator does not support
the remove operation.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |