Data Abstraction / Mutability.
Rewrite Bloch's Stack class so that it is immutable. Keep the same representation. Follow Liskov. (We'll cover Bloch's additional constraints required for immutability later.)
Note that this is the same example we cover with in-class exercise #7.
Provide an overview, method signatures, method specifications, and the methods themselves. You do not need to provide the abstraction function or representation invariant for this exercise. Clean up anything that is no longer appropriate.
Create a decent set of JUnit tests.
Note: A flyweight version of the
makes for an interesting exercise.
Anyone who builds a high quality one and can explain why it's good
earns 2 points of bonus credit.