1

I didn't understand the difference in the two below statement :-

 HashMap<Integer,String> hashmap = new HashMap<Integer,String>();

 Map<Integer,String> hashmap = new HashMap<Integer,String>();

The above two statement work in the same manner , no difference in the ouptput OR there is any time difference on running two statement.

Sachin Jain
  • 168
  • 2
  • 9
  • 6
    http://stackoverflow.com/questions/383947/what-does-it-mean-to-program-to-an-interface – Reimeus Oct 16 '15 at 14:44
  • Its just that `Map` is an interface which is implemented by `HashMap`. And it is the better of two options – SacJn Oct 16 '15 at 14:48

1 Answers1

0

Map<> is the interface which HashMap<> implements. See here for more info.

jonk
  • 1,494
  • 11
  • 13