Class SimpleHashFunction

    • Method Detail

      • hash

        public int hash​(CharSequence key)
        Hashes a key, i.e. turns it into an integer for use in a HashTable.

        This implementation is the same hash function as Java's String.toString().

        It does not delegate to String.toString() in order to protect against future changes in the JDK (?) or different JDK implementations, so that the resulting hash can safely be used for persistence (e.g. to route data to a file).

        Specified by:
        hash in interface HashFunction
        Parameters:
        key - A key to hash.
        Returns:
        A hash.