Goal:
Favoring composition over inheritance. Bloch, Item 18.
Consider the InstrumentedSet
example from
Bloch Item 18 (as well as in-class exercise #10A).
Set
(globally) with List
.
There is no problem with equals()
.
Why not?
Set
(globally) with Collection
.
Now equals()
does not satisfy its contract.
The GTA will look for correct responses, appropriate JUnit tests, and plausible explanations when doing the grading.