Class AbstractMap.MapEntry<K,V>

  • All Implemented Interfaces:
    Entry<K,V>
    Enclosing class:
    AbstractMap<K,V>


    protected static class AbstractMap.MapEntry<K,V>
    extends java.lang.Object
    implements Entry<K,V>
    A concrete implementation of the Entry interface to be used within a Map implementation.
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      private K k 
      private V v 
    • Constructor Summary

      Constructors 
      Constructor and Description
      MapEntry(K key, V value)
      Construct a map entry
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      boolean equals(Entry<K,V> e)
      Determine equality of two entries
      boolean equals(java.lang.Object e)
      Determine equality of entry and object
      K getKey()
      Returns the key stored in this entry.
      V getValue()
      Returns the value stored in this entry.
      protected void setKey(K key)
      Set the key
      protected V setValue(V value)
      Set the value and return the old value
      java.lang.String toString()
      Give a string representation to help debugging
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • k

        private K k
      • v

        private V v
    • Constructor Detail

      • MapEntry

        public MapEntry(K key,
                        V value)
        Construct a map entry
        Parameters:
        key - Key
        value - Value
    • Method Detail

      • getKey

        public K getKey()
        Returns the key stored in this entry.
        Specified by:
        getKey in interface Entry<K,V>
        Returns:
        the entry's key
      • getValue

        public V getValue()
        Returns the value stored in this entry.
        Specified by:
        getValue in interface Entry<K,V>
        Returns:
        the entry's value
      • setKey

        protected void setKey(K key)
        Set the key
        Parameters:
        key - Key
      • setValue

        protected V setValue(V value)
        Set the value and return the old value
        Parameters:
        value - Value
        Returns:
        Old value
      • equals

        public boolean equals(java.lang.Object e)
        Determine equality of entry and object
        Overrides:
        equals in class java.lang.Object
        Parameters:
        e - Object
        Returns:
        Equality between entry and object
      • equals

        public boolean equals(Entry<K,V> e)
        Determine equality of two entries
        Parameters:
        e - Entry
        Returns:
        Equality between two entries
      • toString

        public java.lang.String toString()
        Give a string representation to help debugging
        Overrides:
        toString in class java.lang.Object
        Returns:
        String representation