Missing method in Multimap

11 views
Skip to first unread message

Hein Meling

unread,
Dec 30, 2009, 3:31:28 PM12/30/09
to Google Collections Library - users list
Hi all,

I don't know if this is something that others would find useful, but I need it for my multimap:

putAll(Map<? extends K,? extends V> map)

That is, to populate/add the multimap with the content of a map. Obviously, the keys would have only a single value in its collection initially, but that might change with time (after the initial putAll()). Also, some keys might already exist in the multimap, in which case the map.value should be added to the corresponding collection in the multimap.

Is this already possible through other means that I'm unaware of? Obviously, I see the other putAll() methods provided.

PS: Congratulations on the release of 1.0 final!

All the best,

:) Hein

Kevin Bourrillion

unread,
Dec 30, 2009, 3:46:52 PM12/30/09
to Hein Meling, Google Collections Library - users list
multimap.putAll(Multimaps.forMap(map))

HTH.




--
Google Collections Library - users list
http://groups.google.com/group/google-collections-dev?hl=en

To unsubscribe, send email to:
google-collections...@googlegroups.com



--
Kevin Bourrillion @ Google
internal:  http://go/javalibraries
external: guava-libraries.googlecode.com

Hein Meling

unread,
Jan 1, 2010, 1:31:41 PM1/1/10
to Google Collections Library - users list
Thanks for the tip, Kevin.

Seems that you guys have thought of everything; only its not always obvious where to look for it (ok, I should've looked in Multimaps ;-)

Anyway, I've been looking through the api of Guava, and seems that there are a few other things that you might wish to add to the primitives package classes like: Ints, Longs, Floats etc.:

sum()
average()

At least sum() is equally common to min() and max() over arrays of different types of numbers.

All the best,

:) Hein

Reply all
Reply to author
Forward
0 new messages