Java Utililty Methods Hash Code Calculate

List of utility methods to do Hash Code Calculate

Description

The list of methods to do Hash Code Calculate are organized into topic(s).

Method

intcombinedHashCode(Object... objects)
Combines hash codes from multiple objects to make a new one.
final int prime = 31;
int result = 1;
for (Object obj : objects) {
    result = prime * result + getHashCode(obj);
return result;
intcombineHashCodes(final int pHashCode_1, final int pHashCode_2)
Combine two hash codes to obtain a third one representing both.
return intHashCode(intHashCode(pHashCode_1) - pHashCode_2);
intcombineHashCodes(int hashCode1, int hashCode2)
Combines two hash codes to make a new one.
return hashCode1 * 17 + hashCode2;
intcombineHashCodes(int hashCode1, int hashCode2)
Combines two hash codes to make a new one.
return hashCode1 * 31 + hashCode2;
intcombineHashCodes(int numA, int numB, int numC)
Combines 3 hash codes to make a new one.
final int prime = 31;
int result = 1;
result = prime * result + numA;
result = prime * result + numB;
result = prime * result + numC;
return result;
intcombineHashCodesHelper(int hashCode1, int hashCode2)
combine Hash Codes Helper
int out = 1500450271;
out = ~~(~~(hashCode1 * out) + ~~(hashCode2 & out));
out = ~~(hashCode1 ^ out - hashCode2);
return ~~(hashCode2 ^ out - hashCode1);
intcombineHashes(int hash1, int hash2)
combine Hashes
hash1 += (hash2 & 0xffff);
hash1 = (hash1 << 16) ^ ((hash2 >>> 5) ^ hash1);
hash1 += hash1 >>> 11;
return hash1;
intcombineHashesBad(int hash1, int hash2)
combine Hashes Bad
return hash1 ^ hash2;
intcombineHashesMurmur(int hash2, int hash1)
combine Hashes Murmur
hash1 *= 0xcc9e2d51;
hash1 = Integer.rotateLeft(hash1, 15);
hash1 *= 0x1b873593;
hash2 ^= hash1;
hash2 = Integer.rotateLeft(hash2, 13);
hash2 = hash2 * 5 + 0xe6546b64;
return hash2;
intcombineHashesOld(int hash1, int hash2)
combine Hashes Old
hash1 ^= (hash2 & 0xff);
hash1 *= FNV_PRIME;
hash1 ^= (hash2 >>> 8) & 0xff;
hash1 *= FNV_PRIME;
hash1 ^= (hash2 >>> 16) & 0xff;
hash1 *= FNV_PRIME;
hash1 ^= (hash2 >>> 24) & 0xff;
hash1 *= FNV_PRIME;
...