Manikandan Thiagarajan
asked on
Difference between Map and Set
Difference between Map and Set
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Think of it as a list that can only contain unique objects as dictated by their equals method
A map has a pair for example
(key, object).
With key you can get the object
A set is just the object (object) just one.
(key, object).
With key you can get the object
A set is just the object (object) just one.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
>>Set s = new HashSet ( al ) ;
so this would avoid the duplicate values in array list
so this would avoid the duplicate values in array list
The array list will still contain those duplicates, the set will not.
:-)
ASKER
could you explain this one