I did'nt see that I were replying only to Dimitris... so
On Tue, Jun 22, 2010 at 5:32 PM, Dimitris Andreou
<
jim.a...@gmail.com> wrote:
By the way, sorry for misunderstanding your question, got entirely the
wrong idea :) I only realized seeing Jared's reply.
I don't know if Jared replies to you or me, but in my case, the
Multimap.replaceValues() does'nt work as I expect.
Indeed, when I replace
final Map<Key, Iterable<Value>> map = Maps.newHashMap();
for (final Key key : keys) {
map.put(process, getPerhapsValues());
}
by
final Multimap<Key, Value> map = ArrayListMultimap.create();
for (final Key process : processes) {
map.replaceValues(process, getPerhapsValues());
}
if, the function getPerhapsValues() returns an empty iterable, then in
the Map I have some entries like <key, [empty]>, but in the second
one, these entries don't exist in the Multimap.
Anyway, I got my answer, and the javadoc will be updated to be more
explicit, Thanks a lot :)
On Jun 22, 5:20 pm, Jared Levy <
jared.l.l...@gmail.com> wrote:
> The Multimap.putAll() Javadoc is vague. We'll fix it; thanks for pointing
> out the issue.
>
> Multimap.replaceValues() provides the functionality you're looking for.
>
> On Tue, Jun 22, 2010 at 5:32 AM, Sylvain MINA <
sylvain.m...@gmail.com>wrote:
>
>
>
> > Hi all,
>
> > Since I use google-collections and now guava, I wanted to use Multimap in a
> > wrong way.
> > I replace Map<K, Collection<V>> by Mulitmap<K,V>, but as a result some of
> > UT were broken. Indeed, I wanted use the putAll(K, Iterable<V>) with an
> > empty Iterable to "initialize" the multimap content. I wondered why it
> > didn't work... I saw nothing about that in the javadoc, but I understood the
> > behavior when I read the sources.
>
> > Am I the only one who has been tricked by this ? Would it be interresting
> > to mention the behavior in the javadoc ? Is it a bad smell if I want to
> > populate a multimap in this way ?
>
> > (Perhaps this question have been already asked, but I didn't find it,
> > neither in the mailing list, nor in the issues, nor on
stackoverflow.com)
>
> > (Apologize for my frenglish....)
>
> > --
> >
guava-...@googlegroups.com.
> >
http://groups.google.com/group/guava-discuss?hl=en
> > unsubscribe:
guava-discus...@googlegroups.com<guava-discuss%2Bunsubscribe@goog
legroups.com>