Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImmutableListMultimap.copyOf(Map<K, List<V>>), etc. #465

Open
gissuebot opened this issue Oct 31, 2014 · 11 comments
Open

ImmutableListMultimap.copyOf(Map<K, List<V>>), etc. #465

gissuebot opened this issue Oct 31, 2014 · 11 comments

Comments

@gissuebot
Copy link

gissuebot commented Oct 31, 2014

Original issue created by [email protected] on 2010-11-03 at 01:14 PM


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...

@gissuebot
Copy link
Author

Original comment posted by joe.j.kearney on 2010-11-03 at 05:57 PM


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/f1b947827bf5b6d

@gissuebot
Copy link
Author

Original comment posted by [email protected] on 2011-01-27 at 06:01 AM


(No comment entered for this change.)


Status: Accepted
Labels: Type-Enhancement

@gissuebot
Copy link
Author

gissuebot commented Oct 31, 2014

Original comment posted by [email protected] on 2011-03-31 at 12:26 PM


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?

@gissuebot
Copy link
Author

Original comment posted by [email protected] on 2011-07-13 at 06:18 PM


(No comment entered for this change.)


Status: Triaged

@gissuebot
Copy link
Author

gissuebot commented Oct 31, 2014

Original comment posted by [email protected] on 2011-11-20 at 03:32 PM


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.

@gissuebot
Copy link
Author

Original comment posted by [email protected] on 2011-12-10 at 03:51 PM


(No comment entered for this change.)


Labels: Package-Collect

@gissuebot
Copy link
Author

Original comment posted by [email protected] on 2012-02-16 at 07:17 PM


(No comment entered for this change.)


Status: Acknowledged

@gissuebot
Copy link
Author

Original comment posted by [email protected] on 2012-05-30 at 07:43 PM


(No comment entered for this change.)


Labels: -Type-Enhancement, Type-Addition

@gissuebot
Copy link
Author

Original comment posted by [email protected] on 2012-06-22 at 06:16 PM


(No comment entered for this change.)


Status: Research

@gissuebot
Copy link
Author

Original comment posted by wasserman.louis on 2013-03-16 at 03:52 AM


Issue #1341 has been merged into this issue.

@cgdecker cgdecker removed the migrated label Nov 1, 2014
@kevinb9n kevinb9n changed the title <K,V> ImmutableMultimap<K,V> ImmutableMultimap.copyOf(Map<K, ? extends Collection<V>>) ImmutableListMultimap.copyOf(Map<K, List<V>>), etc. Apr 15, 2015
@kevinb9n
Copy link
Contributor

We should research current builder usages to learn what common things we might want to streamline.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants