DaveAKing / guava-libraries

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

Sets$SetView#contains(Object object) - not working as expected #1655

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I would have expected the SetView#contains(Object object) method to check if 
the given object is currently present and 'visible' in the view.

And not as currently implemented checking whether or not the List is part of 
the view. 

Original issue reported on code.google.com by knitel...@gmail.com on 3 Feb 2014 at 10:39

GoogleCodeExporter commented 9 years ago
Please give more detail about what you're seeing and what you expect. Is this a 
performance problem, a correctness problem, or something else? Can you submit a 
short test that demonstrates the problem?

The various SetView.contains() implementations I see:

        return set1.contains(object) || set2.contains(object);
        return set1.contains(object) && set2.contains(object);
        return set1.contains(element) && !set2.contains(element);

Original comment by cpov...@google.com on 3 Feb 2014 at 2:31

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
The class you're looking at is CartesianSet.

https://code.google.com/p/guava-libraries/source/browse/guava/src/com/google/com
mon/collect/Sets.java?spec=svnf26b23aa417b94b872daf38845bca572da8f69ab&r=f26b23a
a417b94b872daf38845bca572da8f69ab#1087

cartesianProduct is behaving as described in its documentation:

http://docs.guava-libraries.googlecode.com/git/javadoc/com/google/common/collect
/Sets.html#cartesianProduct%28java.util.Set...%29

Original comment by cpov...@google.com on 3 Feb 2014 at 3:11

GoogleCodeExporter commented 9 years ago
Sorry my fault, I looked at the wrong contains method. 

Works as expected.

Original comment by knitel...@gmail.com on 3 Feb 2014 at 3:18

GoogleCodeExporter commented 9 years ago
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

GoogleCodeExporter commented 9 years ago

Original comment by cgdecker@google.com on 3 Nov 2014 at 9:07