In the preceding chapters, we have defined a number of collection types in which all elements of the collection are
ints. Such collections are rather limiting. For example, suppose we wanted a set that contained
Strings. We would not be able to use our implementation of
IntSet for this purpose. Instead, we would need to provide a separate implementation for a
StringSet. And if we later discovered the need for a set of characters, we would need yet another new implementation.
Having to define a new version of a collection abstraction each time we need to store a different type of element is not very satisfactory. Instead, it would be better to define the collection type just once yet have it work for all types of elements. ...