CS/SWE 332 Assignment 10
Fall 2020


Goal: Favoring composition over inheritance. Bloch, Item 18.

Consider the InstrumentedSet example from Bloch Item 18 (as well as in-class exercise 18).

  1. Replace Set with List. There is no problem with equals(). Why not?
  2. Replace 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.