• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how to retrive values for key in MultiMap

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi..

can any one tell me how to retrive values for a given key using MultiMap(

my java code in given below

MultiMap Mp =new MultiHashMap();
Mp.put("1","aaaaaaa");
Mp.put("2","bbbb");
Mp.put("3","ccccc");
Mp.put("1","eeeedddd");
Mp.put("1","aaaggggg");
Mp.put("3","nnaaa");

i want output like 1 aaaaaaa
eeeedddd
aaaggggg
2 bbbb
3 ccccc
nnaaa

Thanks

cheers
Mallik



 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"malli",
Please check your private messages.
-Ben
 
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
According to the MultiHashMap API, you need to use the get method to return the collection that is stored at each key. Try this:

List values = Mp.get("1");
 
reply
    Bookmark Topic Watch Topic
  • New Topic