Joshua Bloch wrote in Effective
Java that for the hashCode method all the fields taken into account by equals should be used.
However I undertand that it would be admisible to use only one, say "i":
a) Two objects considered equal (same i, and same j) would end up into the same bucket (in a hash structure), because their fields "i" are the same and hashCode produces the same value.
b) Two objects with the same "i" but different "j" still go to the same bucket. But potentially many more objects could end up in the same bucket than if we were using a hashCode that considers both "i" and "j"; all of them with the same "i" but a different "j". The result is that the sequential search in the bucket for objects to be comnpared with equals would degrade the goal of a hash structure --performance.
Joshua also wrote:
Do not be tempted to exclude significant parts of an object from the hash code computation to improve performance (in the computation)...
...quality might degrade to the point where hash tables become unusably slow.