Closed GoogleCodeExporter closed 9 years ago
These methods are correct both in the JDK and here. It must be legal to ask a
Set<?
extends Number> whether or not it contains 'new Integer(1)'.
Unfortunately all I have time for at the moment is to point you at this
explanation I
wrote long ago:
http://smallwig.blogspot.com/2007/12/why-does-setcontains-take-object-not-e.html
I am guessing you probably will not find it convincing, but it's the best I can
do
for now.
Original comment by kevin...@gmail.com
on 16 Jun 2009 at 5:34
Yeah, I did some searching for it and realized that wildcards break these. How
does
Multimap.get(K) not run into this issue?
Original comment by john.car...@gmail.com
on 16 Jun 2009 at 5:48
get(K) returns a collection that is a "live view" -- you can add new elements
into it
and thus cause them to appear in the multimap. Therefore it has to be limited
to Ks
only!
Sorry for my terse response last night.
Original comment by kevin...@gmail.com
on 16 Jun 2009 at 4:55
Thanks for the update. I realized that you can call get(K) on an object that
isn't
yet in the Multimap and it will populate if you add to the returned collection.
I
like the idea of using IntelliJ static analysis to catch the
Collections.remove(Object) error for you when doing refactoring. I'm going to
try to
see if I can get findbugs to do the same thing for eclipse.
Original comment by john.car...@gmail.com
on 16 Jun 2009 at 10:52
Original issue reported on code.google.com by
john.car...@gmail.com
on 16 Jun 2009 at 5:21