Hi all,
I've noticed a couple of people over-specifying the generic
collections. The general pattern is:
Map<Key,Value> myMap = new HashMap();
where the field is given a type of the general interface with the
type parameters and the constructor is the specific implementation
without the type parameters. The assignment works because in Java
(unlike C++) every T1<T2> extends T1. The advantage of the general
interface (eg. "Map" instead of "HashMap") is that if you change the
implementation later, you only need to change the constructor.
Thanks,
Owen