Java Iterator & Inner class

After reading this chapter and engaging in the embedded activities and reflections, you should be able to:

  • Describe the iterator design pattern.
  • Differentiate between the Java Iterable and Iterator interfaces.
  • Declare, specify and test Iterable ADTs.
  • Write a Java class that implements the Iterable interface.
  • Write a Java class that implements the Iterator interface.
  • Appreciate that an inner class (non-static) Iterator implementation is an instance member and has access to the instance members of the outer class.
  • Understand the data encapsulation resulting from private inner classes.

Starter code for this chapter

Solution code

Solution code for this chapter.