Interface COM.odi.util.ListIterator
- public interface ListIterator
- extends Iterator
This is the COM.odi.util version of java.util.ListIterator,
which will be generally available in the JDK 1.2. At that
time, COM.odi.util.ListIterator will be obsoleted, in favor
of the interface in java.util.ListIterator.
-
add(Object)
- Inserts the specified element into the List.
-
hasNext()
- Returns true if this ListIterator has more elements when
traversing the list in the forward direction.
-
hasPrevious()
- Returns true if this ListIterator has more elements when
traversing the list in the reverse direction.
-
next()
- Returns the next element in the List.
-
nextIndex()
- Returns the index of the element that would be returned by a
subsequent call to next.
-
previous()
- Returns the previous element in the List.
-
previousIndex()
- Returns the index of the element that would be returned by a
subsequent call to previous.
-
remove()
- Removes from the List the last element that was returned by
next or previous.
-
set(Object)
- Replaces the last element returned by next or previous with the
specified element.
hasNext
public abstract boolean hasNext()
- Returns true if this ListIterator has more elements when
traversing the list in the forward direction. (In other words,
returns true if next would return an element rather than
throwing an exception.)
next
public abstract Object next()
- Returns the next element in the List. This method may be
called repeatedly to iterate through the List, or intermixed
with calls to previous to go back and forth. (Note that
alternating calls to next and previous will return the same
element repeatedly.)
- Throws: NoSuchElementException
- iteration has no next element.
hasPrevious
public abstract boolean hasPrevious()
- Returns true if this ListIterator has more elements when
traversing the list in the reverse direction. (In other words,
returns true if previous would return an element rather than
throwing an exception.)
previous
public abstract Object previous()
- Returns the previous element in the List. This method may be
called repeatedly to iterate through the list backwards, or
intermixed with calls to next to go back and forth. (Note that
alternating calls to next and previous will return the same
element repeatedly.)
- Throws: NoSuchElementException
- iteration has no previous
element.
nextIndex
public abstract int nextIndex()
- Returns the index of the element that would be returned by a
subsequent call to next. (Returns List size if the ListIterator
is at the end of the list.)
previousIndex
public abstract int previousIndex()
- Returns the index of the element that would be returned by a
subsequent call to previous. (Returns -1 if the ListIterator is
at the beginning of the list.)
remove
public abstract void remove()
- Removes from the List the last element that was returned by
next or previous. This call can only be made once per call to
next or previous. Optional operation.
- Throws: UnsupportedOperationException
- remove is not supported
by this ListIterator.
- Throws: NoSuchElementException
- neither next nor previous have been
called, or remove has already been called after the last call
to next or previous.
set
public abstract void set(Object o)
- Replaces the last element returned by next or previous with the
specified element. Optional operation.
- Throws: UnsupportedOperationException
- set is not supported
by this ListIterator.
- Throws: NoSuchElementException
- neither next nor previous have been
called, or remove was called after the last call to next or
previous.
add
public abstract void add(Object o)
- Inserts the specified element into the List. The element is
inserted immediately before the next element that would be
returned by getNext, if any, and after the next element that
would be returned by getPrevious, if any. (If the List contains
no elements, the new element becomes the sole element on the
List.) This call does not move the cursor: a subsequent call
to next would return the element that was added by the call,
and a subsequent call to previous would be unaffected.
Optional operation.
- Throws: UnsupportedOperationException
- add is not supported
by this ListIterator.
Copyright © 1996, 1997, 1998 Object Design, Inc. All rights reserved.