CS/SWE 332 Assignment 7
Due Wednesday, October 17, 2018

Goal: Iteration Abstraction

This week we discussed iteration abstraction in terms of abstract states. The homework is to implement an iterator.

Consider the GrowList.java code from the in-class exercises. Make GrowList implement the Iterable interface. This will require you to implement an iterator() method. You can use Liskov as a guide for this; she implements iterators with static inner classes. Or you can check out how iterators are implemented in the Java collection classes (which, I believe, is pretty much the same thing).

To demo your Iterable implementation, write code that uses a foreach loop to visit every element in the [cat, dog, elephant] GrowList.

Note: You'll encounter four default methods during this exercise. The only one that matters for grading is the remove() method: Do the right thing with remove(). You're welcome to override the other default methods as well, but it's not required for grading purposes.

The deliverable is a story. Make your story clear and easy to read for the GTA. I want you to explain the important bits about what you did, and why you made specific decisions.