Closed GoogleCodeExporter closed 9 years ago
See related Issue 736:
http://code.google.com/p/guava-libraries/issues/detail?id=736&colspec=ID%20Type%
20Status%20Milestone%20Summary&start=100
Original comment by dancerj...@gmail.com
on 4 Oct 2011 at 6:37
Out of curiosity, would you be satisfied by something in ImmutableMap.Builder?
Original comment by wasserman.louis
on 10 Oct 2011 at 2:39
First, I assume you mean ImmutableMultimap.Builder since I want to create a
Multimap from a Map of Collections.
But if I need a mutable Multimap, how would I get it from the created immutable
Multimap? There is not a mechanism in Multimaps to do a copy or am I missing
something?
Original comment by dancerj...@gmail.com
on 10 Oct 2011 at 2:51
HashMultimap.create(Multimap) is a "copy constructor" style factory.
Original comment by wasserman.louis
on 20 Oct 2011 at 7:23
Yes, but it does not take a Map<K, Collection<V>> as is returned by
Multimap.asMap(). The point I am trying to make is that to utilize Maps
functionality on a Multimap you must use asMap() but then you can't get it back
into a Multimap form easily.
Original comment by dancerj...@gmail.com
on 20 Oct 2011 at 8:26
I was answering your second question:
> But if I need a mutable Multimap, how would I get it from the created
immutable
> Multimap? There is not a mechanism in Multimaps to do a copy or am I missing
> something?
Original comment by wasserman.louis
on 20 Oct 2011 at 9:24
Oh. Gotcha. Just seems like a lot of processing. If I need to do "Maps"
processing on my Multimap, I need to do as asMap, the processing, then create
an ImmutableMultimap and then copy that to create a mutable Multimap. Seems
like there should be a better way. Unless one or the other of the
ImmutableMulitmap.Builder / Multimap.create don't iterate, the Map is being
iterated twice to turn it back into a Multimap.
All that said, as least with an ImmutableMulitmap.Builder that takes a Map<K,
Collection<V>> there is a way to do it.
Original comment by dancerj...@gmail.com
on 20 Oct 2011 at 9:33
Let's step back to your actual use case:
Would you be satisfied by Multimaps.filterKeys() ?
Original comment by wasserman.louis
on 20 Oct 2011 at 9:54
Yes. Having the various Maps... functionality for Multimaps is what I am
looking for. So in this case, yes a Multimaps.fitlerKeys is what I needed.
Original comment by dancerj...@gmail.com
on 20 Oct 2011 at 9:58
So let's deal with that use case instead of going all the way around like this.
;)
Original comment by wasserman.louis
on 20 Oct 2011 at 10:05
Sounds good to me.
Original comment by dancerj...@gmail.com
on 20 Oct 2011 at 10:07
[deleted comment]
Since the update this is now a duplicate of Issue #625
Original comment by fin...@gmail.com
on 21 Oct 2011 at 12:50
Concur.
Original comment by dancerj...@gmail.com
on 21 Oct 2011 at 8:41
Marked as such.
Original comment by wasserman.louis
on 29 Nov 2011 at 4:12
This issue has been migrated to GitHub.
It can be found at https://github.com/google/guava/issues/<id>
Original comment by cgdecker@google.com
on 1 Nov 2014 at 4:15
Original comment by cgdecker@google.com
on 3 Nov 2014 at 9:09
Original issue reported on code.google.com by
dancerj...@gmail.com
on 4 Oct 2011 at 6:36