next up previous index
Next: Enumeration Up: Linked Lists Previous: Reversing a list   Index

Enumerating elements

It is useful to offer the user a way of walking down the elements of a list one at a time. As explained previously, this is done in Java using an Enumeration or an Iterator. We begin by defining a method called elements which returns an Enumeration of the list. This will later be replaced by a method which returns a more general type of Iterator. But it will be helpful to define the simpler method first.



Subsections

Peter Williams 2005-06-07