If two objects are equal(), their hash codes need to be equal, so like in {@link #equals(Object)}, longHashCode does not consider unused portions of the internal buffers in its calculation.
The hash function used is a simple multiplicative hash function, with the multiplier 65599. While Java's standard multiplier 31 (used in {@link #hashCode()}) gives a good distribution for ASCII strings, it turns out that for foreign-language strings (with 16-bit characters) it gives too many collisions, and a bigger multiplier produces fewer collisions in this case.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|