Version
32.1.3-jre
Description
The internal class CartesianSet returned by Sets.cartesianProduct implements equals in a way that it is never equal to any other Set type because it calls super.equals which is actually Object.equals (and therefore checks for object identity).
That does not seem intended.
Example
Object o1 = ImmutableSet.of(ImmutableList.of(1, 2));
Object o2 = Sets.cartesianProduct(ImmutableList.of(
ImmutableSet.of(1), ImmutableSet.of(2)
));
System.out.println("o1.equals(o2): " + o1.equals(o2));
System.out.println("o2.equals(o1): " + o2.equals(o1));
Version
32.1.3-jre
Description
The internal class
CartesianSetreturned bySets.cartesianProductimplementsequalsin a way that it is never equal to any otherSettype because it callssuper.equalswhich is actuallyObject.equals(and therefore checks for object identity).That does not seem intended.
Example