Introduction to OOP: Chapter 8: The Solitaire Game [next] [previous] [audio] [real] [text]

Using List Iterators

Can be used to loop over list values without exposing internal structure.

ListIterator itr = aList.iterator();
while (! itr.atEnd() ) {
	... do something list itr.current() ...
	itr.next(); 
	}
Intro OOP, Chapter 8, Slide 12

In a chapter of my book on Multiparadigm Programming in Leda, I describe a variety of different approaches to looping. You can read this chapter in either postscript or in pdf.