File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes how to retrive values for key in MultiMap Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "how to retrive values for key in MultiMap" Watch "how to retrive values for key in MultiMap" New topic
Author

how to retrive values for key in MultiMap

malli
Greenhorn

Joined: Dec 12, 2006
Posts: 6
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



Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

"malli",
Please check your private messages.
-Ben


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Bill Cruise
Ranch Hand

Joined: Jun 01, 2007
Posts: 148
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");
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to retrive values for key in MultiMap
 
Similar Threads
No. of correct answers
MultiMap
How to check duplicates in hashmap
SQL questions
which Collection?