This week we discussed iteration abstraction in terms of abstract states. The homework is to implement an iterator.
code from the in-class exercises.
This will require you to implement an
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
implementation, write code that uses a
loop to visit every element in the
[cat, dog, elephant]
Note: You'll encounter four default
methods during this exercise.
The only one that matters for grading is the
Do the right thing with
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.