Quantcast
Channel: Why the coding should be "to the interface" especially for primitive datatypes? - Stack Overflow
Viewing all articles
Browse latest Browse all 7

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

$
0
0

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 all articles
Browse latest Browse all 7

Trending Articles