Class ListMap.Entry

  • All Implemented Interfaces:
    java.util.Map.Entry<K,​V>
    Enclosing class:
    ListMap<K,​V>

    private final class ListMap.Entry
    extends java.lang.Object
    implements java.util.Map.Entry<K,​V>
    Class of entries of the encylosing map. **** I wonder whether there is no generic implementation for Map.Entry.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private K key
      The key of this entry.
      private V value
      The value of this entry corresponding with the key key.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private Entry​(K key, V value)
      Creates a new entry for the enclosing map defined by the given key and value.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)
      Returns whether obj equals this entry, i.e. whether obj is an instance of Map.Entry and both, its key and its value equals key and value of this entry.
      K getKey()
      Returns the key of this entry.
      V getValue()
      Returns the value of this entry.
      int hashCode()  
      V setValue​(V value)
      Sets a new value of this entry and returns the original one.
      • Methods inherited from class java.lang.Object

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

      • key

        private final K key
        The key of this entry. The corresponding value is value.
      • value

        private V value
        The value of this entry corresponding with the key key. Note that in contrast to the key, the value of this entry may be changed (through setValue(Object)).
    • Constructor Detail

      • Entry

        private Entry​(K key,
                      V value)
        Creates a new entry for the enclosing map defined by the given key and value.
    • Method Detail

      • getKey

        public K getKey()
        Returns the key of this entry.
        Specified by:
        getKey in interface java.util.Map.Entry<K,​V>
      • getValue

        public V getValue()
        Returns the value of this entry.
        Specified by:
        getValue in interface java.util.Map.Entry<K,​V>
      • setValue

        public V setValue​(V value)
        Sets a new value of this entry and returns the original one.
        Specified by:
        setValue in interface java.util.Map.Entry<K,​V>
      • hashCode

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

        public boolean equals​(java.lang.Object obj)
        Returns whether obj equals this entry, i.e. whether obj is an instance of Map.Entry and both, its key and its value equals key and value of this entry. Note that both, key and value may be null.
        Specified by:
        equals in interface java.util.Map.Entry<K,​V>
        Overrides:
        equals in class java.lang.Object