EDIT: This question is not about bitwise operators and can't be answered with Why are XOR often used in java hashCode() but another bitwise operators are used rarely?
I've seen different approaches for hash calculation of object:
class A {
public B b;
public C c;
@Override
public boolean equals();
@Override
public int hashCode() {
return c.hashCode() ^ b.hashCode(); //XOR
return c.hashCode() + prime * b.hashCode(); // SUM
return Objects.hash(b,c); // LIB
}
}
It seems LIB method uses SUM, but why is it better than XOR?
Even though the example is in Java, this question is more about math and probabilities.