All Packages Class Hierarchy This Package Previous Next Index
Class list.ListEnum
java.lang.Object
|
+----list.ListEnum
- public class ListEnum
- extends Object
- implements Enumeration
The ListEnum class implements an Enumeration for Linked Lists.
ListEnum objects are mutable.
- Author:
- Kathy Yelick
-
ListEnum(ListNode)
- Creates a new enumeration for the elements linked with ListNodes
starting with l.
-
hasMoreElements()
- Tests if this enumeration contains more elements.
-
nextElement()
- Returns the next element of this enumeration.
ListEnum
public ListEnum(ListNode l)
- Creates a new enumeration for the elements linked with ListNodes
starting with l. Requires that there are no cycles in the list.
hasMoreElements
public boolean hasMoreElements()
- Tests if this enumeration contains more elements.
- Returns:
- true if this enumeration contains more elements; false otherwise
nextElement
public Object nextElement()
- Returns the next element of this enumeration.
Modifies the enumeration to move the enumeration past the returned
element of the list.
- Returns:
- the next element of this enumeration.
All Packages Class Hierarchy This Package Previous Next Index