Help me to Choose Collections
Hi
I need to store a single key multiple values,how i want a collection is
key1,value1,value2,value3....
key2,value1,value2....
please suggest me a suitable collection for the above scenario and help me how to retrieve those values
for eg
for the first iteration my output should be
key1
value1,value2,value3
for the second iteration my output should be
key1
value1,value2
Please help me.. thanks in advance
Re: Help me to Choose Collections
A Map that contains a List as the value. Something like:
Code :
Map<String, List<String>> map = new HashMap<String, List<String>>();
List<String> list = new ArrayList<String>();
list.add("1");
list.add("2");
map.put("First", list);