SWE 619 Assignment 8
Fall 2023


Goal: Generics

Consider Bloch's fully generified version of the Chooser example.

Creat a different Chooser with two changes:

  1. Empty choosers are disallowed. (Note that this change also addresses Bloch's failure to follow his own advice with respect to exception handling.)
  2. Chooser objects are immutable.

Keep the same instance variable. Use exception handling as appropriate. Give a rep-invariant appropriate for your new Chooser. Provide contracts for the constructor and the choose() method.

Add an method called addChoice (with one parameter) that adds a choice to the Chooser. Provide a contract and an implementation.

As before, turn in a clear, concise story demonstrating completion of the assignment.