R
Remon van Vliet
There's something i've been wondering and i'm hoping someone has an
explanation for it that goes beyond "Sun screwed up" :
The interface Map<K,V> (with generics) has these methods defined :
public V get(Object key)
public void put(K key, V value)
Now, what puzzles me is why get is defined like that rather than :
public V get(K key)
In other words, it seems to ignore the generic type defined for the key.
Does anyone have an explanation for this? The same applies to the remove
method by the way.
explanation for it that goes beyond "Sun screwed up" :
The interface Map<K,V> (with generics) has these methods defined :
public V get(Object key)
public void put(K key, V value)
Now, what puzzles me is why get is defined like that rather than :
public V get(K key)
In other words, it seems to ignore the generic type defined for the key.
Does anyone have an explanation for this? The same applies to the remove
method by the way.