Goal:
Favoring composition over inheritance. Bloch, Item 18.
Consider the InstrumentedSet
example from
Bloch Item 18 (as well as in-class exercise 18).
Set
with List
.
There is no problem with equals()
.
Why not?
Set
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.