Oracle Application Development Framework Model and Business Components Java API Reference 10g Release 3 (10.1.3)
B16005-01


oracle.jbo.server.java.util
Interface ListIterator

All Superinterfaces:
Iterator

public interface ListIterator
extends Iterator

An Iterator for Lists that allows the programmer to traverse the List in either direction and modify the list during iteration.

Since:
JDK1.2
See Also:
Collection, List, Iterator, Enumeration

Method Summary
 void add(java.lang.Object o)
          Inserts the specified element into the List.
 boolean hasNext()
          Returns true if this ListIterator has more elements when traversing the list in the forward direction.
 boolean hasPrevious()
          Returns true if this ListIterator has more elements when traversing the list in the reverse direction.
 int index()
          Returns the index of the next element that would be returned by next.
 java.lang.Object next()
          Returns the next element in the List.
 int nextIndex()
          Returns the index of the element that would be returned by a subsequent call to next.
 java.lang.Object previous()
          Returns the previous element in the List.
 int previousIndex()
          Returns the index of the element that would be returned by a subsequent call to previous.
 void remove()
          Removes from the List the last element that was returned by next or previous.
 void set(java.lang.Object o)
          Replaces the last element returned by next or previous with the specified element.

 

Method Detail

hasNext

public 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.)
Specified by:
hasNext in interface Iterator
Since:
JDK1.2

next

public java.lang.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.)
Specified by:
next in interface Iterator
Throws:
NoSuchElementException - iteration has no next element.
Since:
JDK1.2

hasPrevious

public 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.)
Since:
JDK1.2

previous

public java.lang.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.
Since:
JDK1.2

index

public int index()
Returns the index of the next element that would be returned by next. (Returns List size if the ListIterator is at the end of the list.)
Since:
JDK1.2

nextIndex

public 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.)
Since:
JDK1.2

previousIndex

public 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.)
Since:
JDK1.2

remove

public 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.
Specified by:
remove in interface Iterator
Throws:
UnsupportedOperationException - remove is not supported by this ListIterator.
NoSuchElementException - neither next nor previous have been called, or remove has already been called after the last call to next or previous.
Since:
JDK1.2

set

public void set(java.lang.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.
NoSuchElementException - neither next nor previous have been called, or remove was called after the last call to next or previous.
Since:
JDK1.2

add

public void add(java.lang.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.
Since:
JDK1.2

Oracle Application Development Framework Model and Business Components Java API Reference 10g Release 3 (10.1.3)
B16005-01


Copyright © 1997, 2005, Oracle. All rights reserved.