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        Moves the iterator after the previous element.
 23        @return the traversed element
 24     */
 25     Object previous();
 26        
 27     /**
 28        Tests if there is an element before the iterator position.
 29        @return true if there is an element before the iterator position
 30     */
 31     boolean hasPrevious();
 32        
 33     /**
 34        Adds an element before the iterator position
 35        and moves the iterator past the inserted element.
 36        @param element the element to add
 37     */
 38     void add(Object element);
 39        
 40     /**
 41        Removes the last traversed element. This method may
 42        only be called after a call to the next() method.
 43     */
 44     void remove();
 45  
 46     /**
 47        Sets the last traversed element to a different value. 
 48        @param element the element to set
 49     */
 50     void set(Object element);
 51  }