Acerca del problema del map.containsKey(product1)
que hemos tenido que implementar el hashcode también además del equals
http://www.google.es/search?q=map+containskey+hashcode&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:es-ES:official
picar en:
http://java.sun.com/j2se/1.5.0/docs/api/java/util/Map.html
que trae lo siguiente:
Many methods in Collections Framework interfaces are defined in terms
of the equals method. For example, the specification for the
contains(Object key) method says: "returns true if and only if this
map contain a mapping for a key k such that (key==null ? k==null :
key.equals(k))." This specification should not be construed to imply
that invoking Map.containsKey with a non-null argument key will cause
key.equals(k) to be invoked for any key k. Implementations are free to
implement optimizations whereby the equals invocation is avoided, for
example, by first comparing the hash codes of the two keys. (The
Object.hashCode() specification guarantees that two objects with
unequal hash codes cannot be equal.) More generally, implementations
of the various Collections Framework interfaces are free to take
advantage of the specified behavior of underlying Object methods
wherever the implementor deems it appropriate.