Algorithm
Development Kit 1.0

algs.model.list
Class DoubleLinkedListIterator<E>

java.lang.Object
  extended by algs.model.list.DoubleLinkedListIterator<E>
Type Parameters:
E - Underlying type of the element values stored by each node
All Implemented Interfaces:
java.util.Iterator<E>

public class DoubleLinkedListIterator<E>
extends java.lang.Object
implements java.util.Iterator<E>

Provide minimal iterator to walk through the next pointers in the DoubleLinkedList.

Since:
1.0
Version:
1.0, 6/15/08
Author:
George Heineman

Constructor Summary
DoubleLinkedListIterator(DoubleLinkedList<E> elist)
          Constructor for the iterator over the list.
 
Method Summary
 boolean hasNext()
          Determine if more elements exist in iteration.
 E next()
          Return next element in the iteration.
 void remove()
          Remove the most recent element retrieved by the next() iterator method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DoubleLinkedListIterator

public DoubleLinkedListIterator(DoubleLinkedList<E> elist)
Constructor for the iterator over the list.

Parameters:
elist - List to be processed by the iterator.
Method Detail

next

public E next()
Return next element in the iteration.

Specified by:
next in interface java.util.Iterator<E>

hasNext

public boolean hasNext()
Determine if more elements exist in iteration.

Specified by:
hasNext in interface java.util.Iterator<E>

remove

public void remove()
Remove the most recent element retrieved by the next() iterator method.

Specified by:
remove in interface java.util.Iterator<E>
Throws:
java.lang.IllegalStateException - if the next method has not yet been called, or the remove method has already been called after the last call to the next method.

Algorithm Development Kit 1.0

This code supports the Algorithms in a Nutshell book, published by O'Reilly Media, Inc. in November 2008. Please visit the book web page to learn of any changes to the code repository or to record a potential defect.