Why is java.util.Map.get(…) not generic? [duplicate]
问题 This question already has answers here : Closed 9 years ago . Possible Duplicate: What are the reasons why Map.get(Object key) is not (fully) generic This method and a number of other methods in the Map interface are not generic. Almost anywhere a key value is expected as a parameter, it accepts Object instead, namely remove, get and containsKey. Any idea as to why they made this decision. My assumption is that it was done to support legacy code, but to me, I think that is a weak position.