ListIterator.java.html

  1  /**
  2     A list iterator allows access of a position in a linked list.    
  3     This interface contains a subset of the methods of the 
  4     standard java.util.ListIterator interface. The methods for
  5     backward traversal are not included.
  6  */
  7  public interface ListIterator
  8  {  
  9     /**
 10        Moves the iterator past the next element.
 11        @return the traversed element
 12     */
 13     Object next();
 14        
 15     /**
 16        Tests if there is an element after the iterator position.
 17        @return true if there is an element after the iterator position
 18     */
 19     boolean hasNext();
 20        
 21     /**
 22        Adds an element before the iterator position
 23        and moves the iterator past the inserted element.
 24        @param element the element to add
 25     */
 26     void add(Object element);
 27        
 28     /**
 29        Removes the last traversed element. This method may
 30        only be called after a call to the next() method.
 31     */
 32     void remove();
 33  
 34     /**
 35        Sets the last traversed element to a different value. 
 36        @param element the element to set
 37     */
 38     void set(Object element);
 39  }