I would like to be able to retrieve from my com.google.collections.Multimap<A, B>
a Collection<Entry<A, Collection<B>>>
which I expected from the entries()
method, but in fact it returns a Collection<Entry<A, B>>
. Is there a method which does what I want?
Currently I'm iterating like this:
for (A key: mmap.keySet()) {
Collection<B> = mmap.get(A);
//do stuff
}
and I'd prefer to be able to iterate like this:
for (Entry<A, Collection<B>> entry: mmap.entries()) {
//do stuff
}
You can use asMap() method:
for (Entry<A, Collection<B>> entry: mmap.asMap().entrySet()) {
//do stuff
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.