Quantcast
Viewing latest article 1
Browse Latest Browse All 7

Answer by DNA for Why the coding should be "to the interface" especially for primitive datatypes?

The former allows you to change to:

Map<Integer, String> mymap = new TreeMap<Integer, String>(); 

for example, without breaking all the rest of your code.

A much more minor advantage is that your IDE can show you the methods for the interface, rather than the (potentially much larger number of) methods for the implementation.


Viewing latest article 1
Browse Latest Browse All 7

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>