ACMNexus / google-collections

Automatically exported from code.google.com/p/google-collections
Apache License 2.0
0 stars 0 forks source link

Inconsistency in containsAll (equals) of com.google.common.collect.StandardMultimap$WrappedSet #116

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I'm developing some text parsing into MultiMap (HashMultiMap).
During parsing of the values I'm getting very strange problem:
[cut]                
                Set s1=(Set) fset.iterator().next();
            Set s2=(Set) fset2.iterator().next();
            System.out.println("s1(s2)="+s1.containsAll(s2));
            System.out.println("s1.size="+s1.size());
            System.out.println(s1.getClass().getName());
            System.out.println("s2(s1)="+s2.containsAll(s1));
            System.out.println("s2.size="+s2.size());
            System.out.println(s2.getClass().getName());
[/cut]          
Here the output (as you can see s1.containsAll(s2)=true but
s2.containsAll(s1)=false for 
com.google.common.collect.StandardMultimap$WrappedSet
)

s1(s2)=true
s1.size=1
com.google.common.collect.StandardMultimap$WrappedSet
s2(s1)=false
s2.size=1
com.google.common.collect.StandardMultimap$WrappedSet

I've verified follow: s1 and s2 contains single HashMultimap and
first HashMultimap equals to second HashMultimap...

I've attached simple part of code to reproduce the issue.
Used JDK 1.6.10, google-collections: snapshot-20080820

Original issue reported on code.google.com by alex...@gmail.com on 18 Jan 2009 at 2:16

Attachments:

GoogleCodeExporter commented 8 years ago
Hi!
It's very strange but it's not bug of the API!
It's default behavior of the Set.
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4459681

Original comment by alex...@gmail.com on 19 Jan 2009 at 9:36

GoogleCodeExporter commented 8 years ago
To clarify, does the element in s1 have a different hash code than the element 
in s2?
If so, we should close this bug as Invalid.

Original comment by jared.l....@gmail.com on 20 Jan 2009 at 11:48

GoogleCodeExporter commented 8 years ago
Yes,
Please close the bug.

Original comment by alex...@gmail.com on 21 Jan 2009 at 5:21

GoogleCodeExporter commented 8 years ago

Original comment by jared.l....@gmail.com on 21 Jan 2009 at 6:03