Exercise Set 9: Loops with Iterators

Exercise 9.1 Study the given IRange interface for an iterator and its use with the list of Student. An example shows how to use the iterator to find whether a student with the given name is in the list and how to print all items in the list.

Exercise 9.2 The given code defines also an ArrayRange iterator and a TreeRange iterator for binary trees. Use the ArrayRange iterator and the TreeRange iterator to perform the same tasks as in the previous example.

Exercise 9.3 The given code defines a binary search tree of Integers (BST), and an iterator which implements IRange to traverse the tree in inorder.

Exercise 9.4 Design the class DataSet which has as its member data a data collection of Comparable objects, such as list of Integers, or an array of Strings, and a corresponding iterator. Design the following methods in this class:

Make sure you develop the tests for these methods that use at least two different data collection and their corresponding iterators.

Exercise 9.5 (Will be avilable later.) Use the given IRange interface and its FileRange implementation to perform the following tasks: