Because mymap can be instantiated somewhere else with a different implementation of Map
, you should not rely on it being an instance of HashMap
in the code using it.
↧
Answer by user647772 for Why the coding should be "to the interface" especially for primitive datatypes?
↧