I am unable to decide as to which data structure to use for the following purpose
Slno Name
01 abc
01 def
02 abc
03 xyz
I want these to be grouped and then stored accordingly Like: 01 {abc,def}
02 {abc}
03 {xyz}
I want to group these as itemsets based on the sl no value.
Thanks, but map cannot contain duplicate values, I need to have duplicate keys, like 01 mapping to abc,def Can you help me as to how this can be achieved.
saipraneeth nallapareddy
Ranch Hand
Joined: Dec 02, 2009
Posts: 159
posted
0
i guess it is TreeSet which will eliminate the duplicate not the HashMap.
name-value pairs are sufficient.
don't confuse with HashSet and HashMap.
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35258
7
posted
0
Thanks, but map cannot contain duplicate values, I need to have duplicate keys, like 01 mapping to abc,def
That's not duplicate keys in the Map, that's multiple entries in the List.
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32717
4
posted
0
Sneha Kashyap wrote: Thanks, but map cannot contain duplicate values, I need to have duplicate keys, like 01 mapping to abc,def Can you help me as to how this can be achieved.