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 Iterating over MultiValueMap Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Iterating over MultiValueMap" Watch "Iterating over MultiValueMap" New topic
Author

Iterating over MultiValueMap

Adam Kovari
Greenhorn

Joined: Aug 08, 2008
Posts: 7
Hi,
i'm trying to find a way to iterate over every key in a MultiValueMap. Is there any way to get an interation over all keys?

Thanks a lot in advance

Adam
Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 3946
    
  17

If you mean the org.apache.commons.collections.map.MultiValueMap then you can get all the keys via the multiMap.keySet().iterator() method, or get all the entries (one for each key, having a collection as the value) using the multiMap.entrySet().iterator().

I assume any other MultiValueMap would also be an implementation of java.util.Map and so would also have these same methods.


Steve
Adam Kovari
Greenhorn

Joined: Aug 08, 2008
Posts: 7
Thank you for your fast reply, that's what I was looking for.

Adam
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Iterating over MultiValueMap
 
Similar Threads
desgin problem: how to categorize items in new list?
Duplicate keys in Map
Code to store null keys and null values in hashmap
how to store multiple values in one key in hash table
Implementing a HashMap with multiple values for 1 key