+ 4
What is the difference between Map and collection in java??
4 odpowiedzi
+ 7
okay i figured it out..
Collection-----
if we wish to represent group of individual object as a single entity.
ex:- Arraylist, linked list, vector, stack, queue etc.
Maps----
if we want to store both value and the key (key, value pair) then we use mapping concept.
ex:-hashmap,treemap etc
+ 3
Keerttik Titan
list interface and classes which implements it comes under collection interface
+ 3
yes 👍
+ 2
map works on key whereas collection works on index
basically map is used when we dont want duplicate objects (as keys are unique)