DthingApi
|
Public Member Functions | |
boolean | hasNext () |
E | next () |
void | remove () |
An iterator over a sequence of objects, such as a collection.
If a collection has been changed since the iterator was created, methods
and
may throw a
. It is not possible to guarantee that this mechanism works in all cases of unsynchronized concurrent modification. It should only be used for debugging purposes. Iterators with this behavior are called fail-fast iterators.
Implementing Iterable and returning an
allows your class to be used as a collection with the enhanced for loop.
<E> | the type of object returned by the iterator. |
boolean java.util.Iterator< E >.hasNext | ( | ) |
Returns true if there is at least one more element, false otherwise.
Implemented in java.util.ListIterator< E >.
E java.util.Iterator< E >.next | ( | ) |
Returns the next object and advances the iterator.
NoSuchElementException | if there are no more elements. |
Implemented in java.util.ListIterator< E >.
void java.util.Iterator< E >.remove | ( | ) |
Removes the last object returned by
from the collection. This method can only be called once between each call to
.
UnsupportedOperationException | if removing is not supported by the collection being iterated. |
IllegalStateException | if has not been called, or remove |
Implemented in java.util.ListIterator< E >.