|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectedu.colorado.nodes.Lister<E>
public class Lister<E>
A Lister implements Java's Iterator<E>
interface for a linked list made from Node<E> nodes.
Note that this implementation of an Iterator<E> does not
support the remove method. Any activation of remove
results in an
UnsupportedOperationException.
Node| Constructor Summary | |
|---|---|
Lister(Node<E> head)
Initialize a Lister with a specified linked list. |
|
| Method Summary | |
|---|---|
boolean |
hasNext()
Determine whether there are any more elements in this Lister. |
E |
next()
Retrieve the next element of this Lister. |
void |
remove()
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Lister(Node<E> head)
head - a head reference for a linked list of objects
next will return the elements
from this linked list, one after another. If the linked list changes
in any way before all the elements have been returned, then the
subsequent behavior of this Lister is unspecified.| Method Detail |
|---|
public boolean hasNext()
hasNext in interface java.util.Iterator<E>- - none
true if there are more elements in this
Lister; false otherwise.public E next()
Lister.
next in interface java.util.Iterator<E>- - none
a bag whose contents will be added to this bag
hasMoreElements() must be true.
Lister.
Note that each element is only returned once, and then the
Lister automatically advances to the next element.
java.util.NoSuchElementException - Indicates that hasMoreElements() is false.public void remove()
remove in interface java.util.Iterator<E>
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||