Package org.infinispan.commons.hash
Interface Hash
-
- All Known Implementing Classes:
MurmurHash3
public interface Hash
Interface that governs implementations- Author:
- Manik Surtani, Patrick McFarland
- See Also:
MurmurHash3
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description int
hash(byte[] payload)
Hashes a byte array efficiently.int
hash(int hashcode)
An incremental version of the hash function, that spreads a pre-calculated hash code, such as one derived fromObject.hashCode()
.int
hash(Object o)
A helper that calculates the hashcode of an object, choosing the optimal mechanism of hash calculation after considering the type of the object (byte array, String or Object).
-
-
-
Method Detail
-
hash
int hash(byte[] payload)
Hashes a byte array efficiently.- Parameters:
payload
- a byte array to hash- Returns:
- a hash code for the byte array
-
hash
int hash(int hashcode)
An incremental version of the hash function, that spreads a pre-calculated hash code, such as one derived fromObject.hashCode()
.- Parameters:
hashcode
- an object's hashcode- Returns:
- a spread and hashed version of the hashcode
-
hash
int hash(Object o)
A helper that calculates the hashcode of an object, choosing the optimal mechanism of hash calculation after considering the type of the object (byte array, String or Object).- Parameters:
o
- object to hash- Returns:
- a hashcode
-
-