This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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 Android Security Essentials Live Lessons this week in the Android 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: 4168
    
  21

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
 
Consider Paul's rocket mass heater.
 
subject: Iterating over MultiValueMap
 
Similar Threads
Duplicate keys in Map
Code to store null keys and null values in hashmap
Implementing a HashMap with multiple values for 1 key
how to store multiple values in one key in hash table
desgin problem: how to categorize items in new list?