Class MurmurHash


  • public final class MurmurHash
    extends Object
    Author:
    Sam Harwell
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static int finish​(int hash, int numberOfWords)
      Apply the final computation steps to the intermediate value hash to form the final result of the MurmurHash 3 hash function.
      static <T> int hashCode​(T[] data, int seed)
      Utility function to compute the hash code of an array using the MurmurHash algorithm.
      static int initialize()
      Initialize the hash using the default seed value.
      static int initialize​(int seed)
      Initialize the hash using the specified seed.
      static int update​(int hash, int value)
      Update the intermediate hash value for the next input value.
      static int update​(int hash, Object value)
      Update the intermediate hash value for the next input value.
    • Method Detail

      • initialize

        public static int initialize()
        Initialize the hash using the default seed value.
        Returns:
        the intermediate hash value
      • initialize

        public static int initialize​(int seed)
        Initialize the hash using the specified seed.
        Parameters:
        seed - the seed
        Returns:
        the intermediate hash value
      • update

        public static int update​(int hash,
                                 int value)
        Update the intermediate hash value for the next input value.
        Parameters:
        hash - the intermediate hash value
        value - the value to add to the current hash
        Returns:
        the updated intermediate hash value
      • update

        public static int update​(int hash,
                                 Object value)
        Update the intermediate hash value for the next input value.
        Parameters:
        hash - the intermediate hash value
        value - the value to add to the current hash
        Returns:
        the updated intermediate hash value
      • finish

        public static int finish​(int hash,
                                 int numberOfWords)
        Apply the final computation steps to the intermediate value hash to form the final result of the MurmurHash 3 hash function.
        Parameters:
        hash - the intermediate hash value
        numberOfWords - the number of integer values added to the hash
        Returns:
        the final hash result
      • hashCode

        public static <T> int hashCode​(T[] data,
                                       int seed)
        Utility function to compute the hash code of an array using the MurmurHash algorithm.
        Type Parameters:
        T - the array element type
        Parameters:
        data - the array data
        seed - the seed for the MurmurHash algorithm
        Returns:
        the hash code of the data