Interface MinimalPerfectHash.UniversalHash<T>

  • Type Parameters:
    T - the type
    All Known Implementing Classes:
    MinimalPerfectHash.LongHash, MinimalPerfectHash.StringHash
    Enclosing class:
    MinimalPerfectHash<K>

    public static interface MinimalPerfectHash.UniversalHash<T>
    An interface that can calculate multiple hash values for an object. The returned hash value of two distinct objects may be the same for a given hash function index, but as more hash functions indexes are called for those objects, the returned value must eventually be different.

    The returned value does not need to be uniformly distributed.

    • Method Detail

      • hashCode

        int hashCode​(T o,
                     int index,
                     int seed)
        Calculate the hash of the given object.
        Parameters:
        o - the object
        index - the hash function index (index 0 is used first, so the method should be very fast with index 0; index 1 and so on are only called when really needed)
        seed - the random seed (always the same for a hash table)
        Returns:
        the hash value