BRUtil - Making Java a Kinder, Gentler, Place to be.

brutil
Interface ReverseListIterator


public interface ReverseListIterator

A uni-directional iterator that moves in the reverse direction. The ReverseListIterator contains a cursor that lies between elements and that begins after the last element. Calls to previous return the element before the implicit cursor. Current item is defined as the most recent element returned by previous. If none has been returned or the current item has become undefined, then methods that require a current item will fail. The methods remove and set require a current item. The methods remove and insert make the current item undefined. The ListIterator does not support commodification, so any structural modification of the list during the ListIterator's lifetime will result in arbitrary behavior from all ListIterator Methods.


Method Summary
 boolean hasPrevious()
          Returns true if an element exists before the cursor (i.e., if previous will return an element).
 void insert(java.lang.Object elt)
          The given element is inserted immediately after the cursor.
 java.lang.Object previous()
          Returns the element before the cursor and advances the cursor backwards.
 void remove()
          Removes the current item from the list.
 java.lang.Object set(java.lang.Object elt)
          Replaces the current item.
 

Method Detail

hasPrevious

public boolean hasPrevious()
Returns true if an element exists before the cursor (i.e., if previous will return an element).
Returns:
true if an element exists before the cursor.

previous

public java.lang.Object previous()
Returns the element before the cursor and advances the cursor backwards. Current item becomes the element returned.
Returns:
the element before the cursor.
Throws:
NoSuchElementException - if the cursor is before the first element

remove

public void remove()
Removes the current item from the list. This method will fail if the current item is undefined. Current item becomes undefined.
Throws:
IllegalStateException - if current item is undefined.

set

public java.lang.Object set(java.lang.Object elt)
Replaces the current item. This method will fail if the current item is undefined.
Parameters:
elt - the element to replace the current item's element.
Throws:
IllegalStateException - if current item is undefined.

insert

public void insert(java.lang.Object elt)
The given element is inserted immediately after the cursor. A subsequent call to previous is unaffected. If the list is empty, the new element becomes the sole element in the list. Current item becomes undefined.
Parameters:
elt - the element to be inserted.


BRUtil - Making Java a Kinder, Gentler, Place to be.