March 2002
Intermediate to advanced
496 pages
8h 51m
English
When you pass a collection of objects to a client, you will often imply that the contents of the collection are instances of a certain type. For example, if you have a static method getPromotionalFireworks() that returns an instance of List, the implication is that the list contains instances of the Firework class. You can strengthen this type of contract by creating a FireworkList class that guarantees that its contents are instances of Firework. Figure 28.1 shows this class.

The FireworkList ...
Read now
Unlock full access