com.mhhe.clrs2e
Class LinearDLL.LinearDLLIterator

java.lang.Object
  |
  +--com.mhhe.clrs2e.LinkedList.ListIterator
        |
        +--com.mhhe.clrs2e.LinearDLL.LinearDLLIterator
All Implemented Interfaces:
java.util.Iterator
Enclosing class:
LinearDLL

public class LinearDLL.LinearDLLIterator
extends LinkedList.ListIterator

Inner class for an iterator.


Field Summary
private  LinkedList.Node current
          A reference to the Node returned by the most recent call to next.
 
Constructor Summary
LinearDLL.LinearDLLIterator()
          Starts an iteration.
 
Method Summary
 boolean hasNext()
          Returns true if this iterator has more elements, false otherwise.
 java.lang.Object next()
          Returns the next element in the iteration.
 void remove()
          Removes the last element returned by the iterator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

current

private LinkedList.Node current
A reference to the Node returned by the most recent call to next. Initially, it is null.

Constructor Detail

LinearDLL.LinearDLLIterator

public LinearDLL.LinearDLLIterator()
Starts an iteration.

Method Detail

hasNext

public boolean hasNext()
Returns true if this iterator has more elements, false otherwise.

Specified by:
hasNext in interface java.util.Iterator
Specified by:
hasNext in class LinkedList.ListIterator

next

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

Specified by:
next in interface java.util.Iterator
Specified by:
next in class LinkedList.ListIterator

remove

public void remove()
Removes the last element returned by the iterator.

Specified by:
remove in interface java.util.Iterator
Specified by:
remove in class LinkedList.ListIterator
Throws:
java.lang.IllegalStateException - if next has not been called.