Back to index

plt-scheme  4.2.1
Public Member Functions
java.util.Iterator Interface Reference

An object which iterates over a collection. More...

Inheritance diagram for java.util.Iterator:
Inheritance graph
[legend]

List of all members.

Public Member Functions

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).

Detailed Description

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.

Author:
Original author unknown
Eric Blake ebb9@.nosp@m.emai.nosp@m.l.byu.nosp@m..edu
See also:
Collection
ListIterator
Enumeration
Since:
1.2 updated to 1.4

Definition at line 57 of file Iterator.java.


Member Function Documentation

Tests whether there are elements remaining in the collection.

In other words, calling next() will not throw an exception.

Returns:
true if there is at least one more element in the collection

Implemented in java.util.SubList.SLListIterator, java.util.AbstractList.lIListIterator, java.util.AbstractList.ALIterator, and java.util.ListIterator.

Obtain the next element in the collection.

Returns:
the next element in the collection
Exceptions:
NoSuchElementExceptionif there are no more elements

Implemented in java.util.SubList.SLListIterator, java.util.AbstractList.lIListIterator, java.util.AbstractList.ALIterator, and java.util.ListIterator.

Here is the caller graph for this function:

Remove from the underlying collection the last element returned by next (optional operation).

This method can be called only once after each call to next(). It does not affect what will be returned by subsequent calls to next.

Exceptions:
IllegalStateExceptionif next has not yet been called or remove has already been called since the last call to next.
UnsupportedOperationExceptionif this Iterator does not support the remove operation.

Implemented in java.util.SubList.SLListIterator, java.util.AbstractList.lIListIterator, java.util.AbstractList.ALIterator, and java.util.ListIterator.

Here is the caller graph for this function:


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