SWE 619 Assignment 7
Spring 2013


Goal: Polymorphic Abstraction/Generics.

Consider Liskov's mutable set example again, this time in its polymorphic form (see Liskov figures 8.1 and 8.2, pages 191-192).

Your assignment is to make Liskov's abstraction generic. You should implement at least the following methods: insert(), remove(), isIn(), toString(), and subset().

Call the generic version LiskovSet. You should find item 26 in Bloch, in which Bloch does exactly the same thing on a Stack class, an excellent guide. Notice that since the implementation variable Liskov uses is a Vector instead of an array, you don't have to deal with the conflicts between generics and arrays.

You should pay particular attention to the subset() method. The key here is correctly using bounded wildcards. See Bloch, Item 28, for details.

Supply JUnit tests for your implementation.