DthingApi
Public Member Functions | List of all members
java.util.Iterator< E > Interface Template Reference
Inheritance diagram for java.util.Iterator< E >:
java.util.ListIterator< E >

Public Member Functions

boolean hasNext ()
 
next ()
 
void remove ()
 

Detailed Description

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

ConcurrentModificationException

. 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

Iterator

allows your class to be used as a collection with the enhanced for loop.

Parameters
<E>the type of object returned by the iterator.

Member Function Documentation

◆ hasNext()

boolean java.util.Iterator< E >.hasNext ( )

Returns true if there is at least one more element, false otherwise.

See also
next

Implemented in java.util.ListIterator< E >.

◆ next()

E java.util.Iterator< E >.next ( )

Returns the next object and advances the iterator.

Returns
the next object.
Exceptions
NoSuchElementExceptionif there are no more elements.
See also
hasNext

Implemented in java.util.ListIterator< E >.

◆ remove()

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

.

Exceptions
UnsupportedOperationExceptionif removing is not supported by the collection being iterated.
IllegalStateExceptionif has not been called, or
remove
has already been called after the last call to .

Implemented in java.util.ListIterator< E >.


The documentation for this interface was generated from the following file: