Class ListMap.Entry

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

    private final class ListMap.Entry
    extends Object
    implements 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.
    • 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 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 Map.Entry<K,​V>
      • equals

        public boolean equals​(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 Map.Entry<K,​V>
        Overrides:
        equals in class Object