Sets.cartesianProduct gives undocumented IllegalArgumentException due to its size #3742
Labels
P3
package=collect
type=api-docs
Change/add API documentation
type=defect
Bug, not working as expected
The following piece of code throws an undocumented
IllegalArgumentException
:The fact that
Sets::cartesianProduct
will throw anIllegalArgumentException
when there would be more than 2^31-1 elements in the resulting set is not documented as far as I can see.I would like to see one of two solutions:
java.util.Set::size()
specifies that if the size would be more thanInteger.MAX_VALUE
it would simply beInteger.MAX_VALUE
.I like to see this fixed (solution 2), because now I can't even define such a Cartesian product. Iterating over so many elements is of course a different issue, but I have a piece of code that may very quickly find an
element
in the product, because I know it is in there and due to some ordering onelement
.The text was updated successfully, but these errors were encountered: