Infolinks In Text Ads

Feb 12, 2011

ListIterator Interface

ListIterator Interface -
    ListIterator Interface is used for traverse list in both direction. You can find previous element by previous() method and next element by next() method. Within the both method ListIterator maintain the cursor position. ListIterator has previousIndex() for checking that List has previous index or not.
     ListIterator Interface extends Iterator Interface. You can also set any new element in the list.

List of methods within the ListIterator Interface -

void add(E e) -
    This method is used to add a given element into the list.

boolean hasNext() -
    This method is used to check the presence of element in the list when traversing the list in the forward direction.

boolean hasPrevious() -
    This method is used to check the presence of element in the list when traversing the list in the reverse direction.

E next() -
    this method is used to return the next element in the list.

int nextIndex() -
    This method is used for return the index of the next element in the list.

E previous() -
          this method is used to return the previous element in the list.

int previousIndex() -
    This method is used for return the index of the previous element in the list.
         
void remove() -
          This method is used for removes element from the list at the cursor position.

void set(E e) -
    This method is used to replace the element at the cursor position.

No comments:

Post a Comment

LinkWithin

Related Posts Plugin for WordPress, Blogger...