they are the same
but first one is used for convetions i tought
|
what's the main difference between them?
Code:Map<Integer, String> xxx = new HashMap<Integer, String>();Code:HashMap<Integer, String> xxx = new HashMap<Integer, String>();
they are the same
but first one is used for convetions i tought
no, map is interface, which hashmap implements
i was talking about the formation of it:
You should declare it as the first one because this allows you to replace any particular map instance very easily, by changing just one line of code. you should never declare as a implementation eg:Map<Integer, String> xxx = new HashMap<Integer, String>();
HashMap<Integer, String> xxx = new HashMap<Integer, String>();
HashMap<Integer, String> xxx = new HashMap<Integer, String>();
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |