Interface Hash

All Known Implementing Classes:
MurmurHash3

public interface Hash
Interface that governs implementations
Author:
Manik Surtani, Patrick McFarland
See Also:
  • Method Summary

    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 from Object.hashCode().
    int
    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 Details

    • 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 from Object.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