Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

java.util
Class LinkedList.LinkedListItr  view LinkedList.LinkedListItr download LinkedList.LinkedListItr.java

java.lang.Object
  extended byjava.util.LinkedList.LinkedListItr
All Implemented Interfaces:
Iterator, ListIterator
Enclosing class:
LinkedList

private final class LinkedList.LinkedListItr
extends java.lang.Object
implements ListIterator

A ListIterator over the list. This class keeps track of its position in the list and the two list entries it is between.


Field Summary
private  int knownMod
          Number of modifications we know about.
private  LinkedList.Entry lastReturned
          Entry that will be affected by remove() or set().
private  LinkedList.Entry next
          Entry that will be returned by next().
private  int position
          Index of `next'.
private  LinkedList.Entry previous
          Entry that will be returned by previous().
 
Constructor Summary
(package private) LinkedList.LinkedListItr(int index)
          Initialize the iterator.
 
Method Summary
 void add(java.lang.Object o)
          Adds an element between the previous and next, and advance to the next.
private  void checkMod()
          Checks for iterator consistency.
 boolean hasNext()
          Returns true if more elements exist via next.
 boolean hasPrevious()
          Returns true if more elements exist via previous.
 java.lang.Object next()
          Returns the next element.
 int nextIndex()
          Returns the index of the next element.
 java.lang.Object previous()
          Returns the previous element.
 int previousIndex()
          Returns the index of the previous element.
 void remove()
          Remove the most recently returned element from the list.
 void set(java.lang.Object o)
          Changes the contents of the element most recently returned.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

knownMod

private int knownMod
Number of modifications we know about.


next

private LinkedList.Entry next
Entry that will be returned by next().


previous

private LinkedList.Entry previous
Entry that will be returned by previous().


lastReturned

private LinkedList.Entry lastReturned
Entry that will be affected by remove() or set().


position

private int position
Index of `next'.

Constructor Detail

LinkedList.LinkedListItr

LinkedList.LinkedListItr(int index)
Initialize the iterator.

Method Detail

checkMod

private void checkMod()
Checks for iterator consistency.


nextIndex

public int nextIndex()
Returns the index of the next element.

Specified by:
nextIndex in interface ListIterator

previousIndex

public int previousIndex()
Returns the index of the previous element.

Specified by:
previousIndex in interface ListIterator

hasNext

public boolean hasNext()
Returns true if more elements exist via next.

Specified by:
hasNext in interface ListIterator

hasPrevious

public boolean hasPrevious()
Returns true if more elements exist via previous.

Specified by:
hasPrevious in interface ListIterator

next

public java.lang.Object next()
Returns the next element.

Specified by:
next in interface ListIterator

previous

public java.lang.Object previous()
Returns the previous element.

Specified by:
previous in interface ListIterator

remove

public void remove()
Remove the most recently returned element from the list.

Specified by:
remove in interface ListIterator

add

public void add(java.lang.Object o)
Adds an element between the previous and next, and advance to the next.

Specified by:
add in interface ListIterator

set

public void set(java.lang.Object o)
Changes the contents of the element most recently returned.

Specified by:
set in interface ListIterator