kucci / guava-libraries

Automatically exported from code.google.com/p/guava-libraries
Apache License 2.0
0 stars 0 forks source link

<K,V> ImmutableMultimap<K,V> ImmutableMultimap.copyOf(Map<K, ? extends Collection<V>>) #465

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I think it would be useful to transform a JDK like implementation of multimap 
(i.e. Map<K, ? extends Collection<V>>) directly into an immutable multimap (w/o 
needing to create a non-immutable multimap first).

The workaround is to use a builder...

Original issue reported on code.google.com by idanavi...@yahoo.com on 3 Nov 2010 at 1:14

GoogleCodeExporter commented 9 years ago
If this is added I think an extra wildcard on the parameter should be 
considered:

<K,V> ImmutableMultimap<K,V> ImmutableMultimap.copyOf(Map<? extends K, ? 
extends Collection<V>>)

This was discussed in this thread, too:
http://groups.google.com/group/guava-discuss/browse_thread/thread/f1b947827bf5b6
d

Original comment by joe.j.kearney on 3 Nov 2010 at 5:57

GoogleCodeExporter commented 9 years ago

Original comment by kevinb@google.com on 27 Jan 2011 at 6:01

GoogleCodeExporter commented 9 years ago
Is this somewhat related to issue #320? Would 
`ImmutableMultimap.copyOf(Iterable<Map.Entry<K, V>>)`, called with 
`someMultimap.entries()`, be a possible compromise?

What are those "JDK like implementation[s] of multimap" exactly? Wouldn't they 
support the interface I suggested above?

Original comment by j...@nwsnet.de on 31 Mar 2011 at 12:26

GoogleCodeExporter commented 9 years ago

Original comment by kevinb@google.com on 13 Jul 2011 at 6:18

GoogleCodeExporter commented 9 years ago
By "JDK like implementations of multimap" I mean: 
java.util.Map<K, ? extends Collection<V>>
In other words, a regular Map where each key is mapped to a collection.

For such a Map, there's no easy way to get an Iterable<Map.Entry<K, V>>... 
Calling entrySet() on such a Map will return Iterable<Map.Entry<K, 
Collection<V>>>.

The idea is to give an easy way to "translate" existing legacy code (that uses 
JDK) to Guavable code that uses Multimaps.

Original comment by idanavi...@yahoo.com on 20 Nov 2011 at 3:32

GoogleCodeExporter commented 9 years ago

Original comment by fry@google.com on 10 Dec 2011 at 3:51

GoogleCodeExporter commented 9 years ago

Original comment by fry@google.com on 16 Feb 2012 at 7:17

GoogleCodeExporter commented 9 years ago

Original comment by kevinb@google.com on 30 May 2012 at 7:43

GoogleCodeExporter commented 9 years ago

Original comment by kevinb@google.com on 22 Jun 2012 at 6:16

GoogleCodeExporter commented 9 years ago
Issue 1341 has been merged into this issue.

Original comment by wasserman.louis on 16 Mar 2013 at 3:52

GoogleCodeExporter commented 9 years ago
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

GoogleCodeExporter commented 9 years ago

Original comment by cgdecker@google.com on 1 Nov 2014 at 4:18

GoogleCodeExporter commented 9 years ago

Original comment by cgdecker@google.com on 3 Nov 2014 at 9:09