To add to @subtenante, Java is designed so that Java will always be backwards compatible. Generics disallow puts of the wrong type, as this does not break backwards compatibility. The easy way to make sure that the right key is being used is to do this.
K key = null;
V value = null;
Map mapped = new HashMap()
.......//set the key and value..........
mapped.put(key, value)
.....
V var = mapped.get(key);
Problem solved.
One more caveat to generics, any child of a class can also be placed into a collection.
Number k= null;
Number v= null;
Map mapped = new HashMap()
.......//set the key and value..........
k = double someDouble;
v = int someInt;
mapped.put(k, v)
.....
This could cause some big bugs!!