Class IdentityHasher<V>

  • Type Parameters:
    V - the value type
    All Implemented Interfaces:
    Hasher<V>

    public class IdentityHasher<V>
    extends Object
    implements Hasher<V>
    IdentityHasher provides a Hasher implementation based upon an object's identity hashCode and reference equality.
    Author:
    mf 2011.01.07
    • Field Detail

      • INSTANCE

        public static final IdentityHasher INSTANCE
        A singleton instance of the IdentityHasher.
    • Constructor Detail

      • IdentityHasher

        public IdentityHasher()
    • Method Detail

      • hashCode

        public int hashCode​(V o)
        Return a hash for the specified object.
        Specified by:
        hashCode in interface Hasher<V>
        Parameters:
        o - the object to hash
        Returns:
        the hash
      • equals

        public boolean equals​(V va,
                              V vb)
        Compare two objects for equality.
        Specified by:
        equals in interface Hasher<V>
        Parameters:
        va - the first object to compare
        vb - the second object to compare
        Returns:
        true iff the object are equal