Back to index

plt-scheme  4.2.1
Public Member Functions | Private Member Functions | Private Attributes
java.util.AbstractList.ALIterator Class Reference

Obtain an Iterator over this list, whose sequence is the list order. More...

Inheritance diagram for java.util.AbstractList.ALIterator:
Inheritance graph
[legend]
Collaboration diagram for java.util.AbstractList.ALIterator:
Collaboration 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).

Private Member Functions

void checkMod ()

Private Attributes

int pos = 0
int size = AbstractList.this.size()
int last = -1
int knownMod = AbstractList.this.modCount

Detailed Description

Obtain an Iterator over this list, whose sequence is the list order.

This implementation uses size(), get(int), and remove(int) of the backing list, and does not support remove unless the list does. This implementation is fail-fast if you correctly maintain modCount. Also, this implementation is specified by Sun to be distinct from listIterator, although you could easily implement it as return listIterator(0).

Returns:
an Iterator over the elements of this list, in order
See also:
modCount

Definition at line 314 of file AbstractList.java.


Member Function Documentation

Definition at line 322 of file AbstractList.java.

      {
        if (knownMod != AbstractList.this.modCount)
          throw new ConcurrentModificationException();
      }

Here is the caller graph for this function:

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

Implements java.util.Iterator.

Definition at line 328 of file AbstractList.java.

      {
        checkMod();
        return pos < size;
      }

Here is the call graph for this function:

Obtain the next element in the collection.

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

Implements java.util.Iterator.

Definition at line 334 of file AbstractList.java.

      {
        checkMod();
        if (pos == size)
          throw new NoSuchElementException();
        last = pos;
        return AbstractList.this.get(pos++);
      }

Here is the call 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.

Implements java.util.Iterator.

Definition at line 343 of file AbstractList.java.

      {
        checkMod();
        if (last < 0)
          throw new IllegalStateException();
        AbstractList.this.remove(last);
        pos--;
        size--;
        last = -1;
        knownMod = AbstractList.this.modCount;
      }

Here is the call graph for this function:


Member Data Documentation

int java.util.AbstractList.ALIterator.knownMod = AbstractList.this.modCount [private]

Definition at line 319 of file AbstractList.java.

Definition at line 318 of file AbstractList.java.

Definition at line 316 of file AbstractList.java.

Definition at line 317 of file AbstractList.java.


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