Closed GoogleCodeExporter closed 9 years ago
Throwing CME seems like a reasonable behavior to me. (What does
aHashSet.addAll(aHashSet) do?)
Original comment by kevinb@google.com
on 20 Nov 2013 at 8:11
That was my first reaction, too. This case is slightly different, though: It's
more like aHashSet.setMyContentsToExactly(aHashSet). That's still arguably
broken, and of course it's a fictitious method, so there's no real precedent
here. And I haven't heard of this problem before in the long time that Multimap
has been around. I just say all this to point out that the addAll precedent is
inexact.
Original comment by cpov...@google.com
on 20 Nov 2013 at 8:16
I disagree with both aHashSet.addAll(aHashSet) and
aHashSet.setMyContentsToExactly(aHashSet) examples.
One possible interpretation of a multimap is a Map<Key, Collection<Value>>.
When you have an implementation such as SortedSetMultimap, you see that the
underlying collections associated with each key have an importance, and the
multimap is not just a map that allows repetitions.
If CME is a reasonable behavior, then it should also be thrown in this scenario:
public void testMap() {
Map<Long, Long> map = Maps.newHashMap();
map.put(1L, 2L);
map.put(1L, map.get(1L));
}
You can emulate this using
multimap.asMap().put(1L, multimap.get(1L));
And this throws an UnsupportedOperationException
Original comment by cau...@gmail.com
on 21 Nov 2013 at 11:50
This issue has been migrated to GitHub.
It can be found at https://github.com/google/guava/issues/<issue id>
Original comment by cgdecker@google.com
on 1 Nov 2014 at 4:10
Original comment by cgdecker@google.com
on 1 Nov 2014 at 4:17
Original comment by cgdecker@google.com
on 3 Nov 2014 at 9:08
Original issue reported on code.google.com by
cau...@gmail.com
on 19 Nov 2013 at 7:48