Class AbstractHashedMap.HashEntry<K,​V>

  • Type Parameters:
    K - the type of the keys
    V - the type of the values
    All Implemented Interfaces:
    java.util.Map.Entry<K,​V>, KeyValue<K,​V>
    Direct Known Subclasses:
    AbstractLinkedMap.LinkEntry, AbstractReferenceMap.ReferenceEntry
    Enclosing class:
    AbstractHashedMap<K,​V>

    protected static class AbstractHashedMap.HashEntry<K,​V>
    extends java.lang.Object
    implements java.util.Map.Entry<K,​V>, KeyValue<K,​V>
    HashEntry used to store the data.

    If you subclass AbstractHashedMap but not HashEntry then you will not be able to access the protected fields. The entryXxx() methods on AbstractHashedMap exist to provide the necessary access.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected int hashCode
      The hash code of the key
      protected java.lang.Object key
      The key
      protected AbstractHashedMap.HashEntry<K,​V> next
      The next entry in the hash chain
      protected java.lang.Object value
      The value
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected HashEntry​(AbstractHashedMap.HashEntry<K,​V> next, int hashCode, java.lang.Object key, V value)
      Constructs a new instance.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)  
      K getKey()
      Gets the key from the pair.
      V getValue()
      Gets the value from the pair.
      int hashCode()  
      V setValue​(V value)  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • HashEntry

        protected HashEntry​(AbstractHashedMap.HashEntry<K,​V> next,
                            int hashCode,
                            java.lang.Object key,
                            V value)
        Constructs a new instance.
        Parameters:
        next - next.
        hashCode - hash code.
        key - key.
        value - value.
    • Method Detail

      • equals

        public boolean equals​(java.lang.Object obj)
        Specified by:
        equals in interface java.util.Map.Entry<K,​V>
        Overrides:
        equals in class java.lang.Object
      • getKey

        public K getKey()
        Description copied from interface: KeyValue
        Gets the key from the pair.
        Specified by:
        getKey in interface KeyValue<K,​V>
        Specified by:
        getKey in interface java.util.Map.Entry<K,​V>
        Returns:
        the key
      • getValue

        public V getValue()
        Description copied from interface: KeyValue
        Gets the value from the pair.
        Specified by:
        getValue in interface KeyValue<K,​V>
        Specified by:
        getValue in interface java.util.Map.Entry<K,​V>
        Returns:
        the value
      • hashCode

        public int hashCode()
        Specified by:
        hashCode in interface java.util.Map.Entry<K,​V>
        Overrides:
        hashCode in class java.lang.Object
      • setValue

        public V setValue​(V value)
        Specified by:
        setValue in interface java.util.Map.Entry<K,​V>
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object