SWE/CS 332 In Class Exercise # 4


Name(s):

Goals: More converting preconditions into postconditions

Consider the following three excerpts from the java collection classes documentation:

  1. Why are all three of these constraints preconditions?


  2. HashSet implements both the Set and Iterator interface (the former directly, and the latter through the iterator() method). Have either of the first two preconditions above been converted into postconditions via the exception handling mechanism?


  3. How do you know?


  4. Can you guess at the likely reason that these two cases are handled differently?