Item 29: Consider typesafe heterogeneous containers
For example, a database row can have arbitrarily many columns, and it would be nice to be able to access all of them in a typesafe manner. Luckily, there is an easy way to achieve this effect. The idea is to parameterize the key instead of the container. Then present the parameterized key to the container to insert or retrieve a value. The generic type system is used to guarantee that the type of the value agrees with its key.
Share this highlighthttp://www.safaribooksonline.com/a/effective-java-2nd/235016/