Back to index

plt-scheme  4.2.1
Public Member Functions | Package Functions | Package Attributes | Private Attributes
java.util.SubList.SLListIterator Class Reference

Specified by AbstractList.subList to return a wrapper around the backing list's iterator. More...

Inheritance diagram for java.util.SubList.SLListIterator:
Inheritance graph
[legend]
Collaboration diagram for java.util.SubList.SLListIterator:
Collaboration graph
[legend]

List of all members.

Public Member Functions

boolean hasNext ()
 Tests whether there are elements remaining in the list in the forward direction.
boolean hasPrevious ()
 Tests whether there are elements remaining in the list in the reverse direction.
Object next ()
 Obtain the next element in the list in the forward direction.
Object previous ()
 Obtain the next element in the list in the reverse direction.
int nextIndex ()
 Find the index of the element that would be returned by a call to next.
int previousIndex ()
 Find the index of the element that would be returned by a call to previous.
void remove ()
 Remove from the list the element last returned by a call to next or previous (optional operation).
void set (Object o)
 Replace the element last returned by a call to next or previous with a given object (optional operation).
void add (Object o)
 Insert an element into the list at the current position of the iterator (optional operation).

Package Functions

 SLListIterator (int i)

Package Attributes

int index

Private Attributes

final ListIterator i
int position = index

Detailed Description

Specified by AbstractList.subList to return a wrapper around the backing list's iterator.

Parameters:
indexthe start location of the iterator
Returns:
a list iterator over the sublist

Definition at line 856 of file AbstractList.java.


Constructor & Destructor Documentation

Definition at line 859 of file AbstractList.java.

{ index = i; }

Member Function Documentation

Insert an element into the list at the current position of the iterator (optional operation).

The element is inserted in between the element that would be returned by previous and the element that would be returned by next. After the insertion, a subsequent call to next is unaffected, but a call to previous returns the item that was added. The values returned by nextIndex() and previousIndex() are incremented.

Parameters:
othe object to insert into the list
Exceptions:
ClassCastExceptionthe object is of a type which cannot be added to this list
IllegalArgumentExceptionsome other aspect of the object stops it being added to this list
UnsupportedOperationExceptionif this ListIterator does not support the add operation

Implements java.util.ListIterator.

Definition at line 916 of file AbstractList.java.

      {
        i.add(o);
        SubList.this.size++;
        position++;
        SubList.this.modCount = SubList.this.backingList.modCount;
      }

Here is the call graph for this function:

Tests whether there are elements remaining in the list in the forward direction.

In other words, next() will not fail with a NoSuchElementException.

Returns:
true if the list continues in the forward direction

Implements java.util.ListIterator.

Definition at line 865 of file AbstractList.java.

      {
        SubList.this.checkMod();
        return position < SubList.this.size;
      }

Here is the call graph for this function:

Tests whether there are elements remaining in the list in the reverse direction.

In other words, previous() will not fail with a NoSuchElementException.

Returns:
true if the list continues in the reverse direction

Implements java.util.ListIterator.

Definition at line 871 of file AbstractList.java.

      {
        SubList.this.checkMod();
        return position > 0;
      }

Here is the call graph for this function:

Obtain the next element in the list in the forward direction.

Repeated calls to next may be used to iterate over the entire list, or calls to next and previous may be used together to go forwards and backwards. Alternating calls to next and previous will return the same element.

Returns:
the next element in the list in the forward direction
Exceptions:
NoSuchElementExceptionif there are no more elements

Implements java.util.ListIterator.

Definition at line 877 of file AbstractList.java.

      {
        if (position == SubList.this.size)
          throw new NoSuchElementException();
        position++;
        return i.next();
      }

Here is the call graph for this function:

Find the index of the element that would be returned by a call to next.

If hasNext() returns false, this returns the list size.

Returns:
the index of the element that would be returned by next()

Implements java.util.ListIterator.

Definition at line 893 of file AbstractList.java.

      {
        return i.nextIndex() - SubList.this.offset;
      }

Here is the call graph for this function:

Here is the caller graph for this function:

Obtain the next element in the list in the reverse direction.

Repeated calls to previous may be used to iterate backwards over the entire list, or calls to next and previous may be used together to go forwards and backwards. Alternating calls to next and previous will return the same element.

Returns:
the next element in the list in the reverse direction
Exceptions:
NoSuchElementExceptionif there are no more elements

Implements java.util.ListIterator.

Definition at line 885 of file AbstractList.java.

      {
        if (position == 0)
          throw new NoSuchElementException();
        position--;
        return i.previous();
      }

Here is the call graph for this function:

Find the index of the element that would be returned by a call to previous.

If hasPrevious() returns false, this returns -1.

Returns:
the index of the element that would be returned by previous()

Implements java.util.ListIterator.

Definition at line 898 of file AbstractList.java.

      {
        return i.previousIndex() - SubList.this.offset;
      }

Here is the call graph for this function:

Remove from the list the element last returned by a call to next or previous (optional operation).

This method may only be called if neither add nor remove have been called since the last call to next or previous.

Exceptions:
IllegalStateExceptionif neither next or previous have been called, or if add or remove has been called since the last call to next or previous
UnsupportedOperationExceptionif this ListIterator does not support the remove operation

Implements java.util.ListIterator.

Definition at line 903 of file AbstractList.java.

      {
        i.remove();
        SubList.this.size--;
        position = nextIndex();
        SubList.this.modCount = SubList.this.backingList.modCount;
      }

Here is the call graph for this function:

Replace the element last returned by a call to next or previous with a given object (optional operation).

This method may only be called if neither add nor remove have been called since the last call to next or previous.

Parameters:
othe object to replace the element with
Exceptions:
ClassCastExceptionthe object is of a type which cannot be added to this list
IllegalArgumentExceptionsome other aspect of the object stops it being added to this list
IllegalStateExceptionif neither next or previous have been called, or if add or remove has been called since the last call to next or previous
UnsupportedOperationExceptionif this ListIterator does not support the set operation

Implements java.util.ListIterator.

Definition at line 911 of file AbstractList.java.

      {
        i.set(o);
      }

Here is the call graph for this function:


Member Data Documentation

Initial value:
 
                    SubList.this.backingList.listIterator(index + SubList.this.offset)

Definition at line 861 of file AbstractList.java.

Definition at line 858 of file AbstractList.java.

Definition at line 863 of file AbstractList.java.


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