Goal:
Data Abstraction / Mutability.
Consider Bloch's generic version of the
Stack
class from the in-class exercise.
Rewrite this class so that it is immutable.
You should keep the same representation.
Note 1: Ignore
the pushAll()
and popAll()
methods
for this assignment.
Note 2: This is a "Liskov-only" exercise.
Bloch has additional rules for immutability, but we're not addressing those (yet).
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. However, you might note that the next assignment requires these mechanisms.
Turn in a story. This means that it is possible to grade your assignment simply by reading it, as if it were part of a textbook. In particular, every place you make a decision to change something in the code (or not), you should have a description of what you did (or didn't do) and why you did (or didn't do) it. Grading:
Stack