Class ImmutableMapEntry<K,​E>

  • All Implemented Interfaces:
    java.util.Map.Entry<K,​E>

    public class ImmutableMapEntry<K,​E>
    extends java.lang.Object
    implements java.util.Map.Entry<K,​E>
    Read-only implementation of Map.Entry.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private K key  
      private E value  
    • Constructor Summary

      Constructors 
      Constructor Description
      ImmutableMapEntry​(K key, E value)
      Constructor of an immutable map entry.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      K getKey()  
      E getValue()  
      E setValue​(E value)
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.Map.Entry

        equals, hashCode
    • Field Detail

      • key

        private K key
      • value

        private E value
    • Constructor Detail

      • ImmutableMapEntry

        public ImmutableMapEntry​(K key,
                                 E value)
        Constructor of an immutable map entry.
        Parameters:
        key - key
        value - value
    • Method Detail

      • getKey

        public K getKey()
        Specified by:
        getKey in interface java.util.Map.Entry<K,​E>
      • getValue

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

        public E setValue​(E value)

        Note that this method fails with an AssertionError because the object is read only.

        Specified by:
        setValue in interface java.util.Map.Entry<K,​E>
      • toString

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