Class ImmutableMapEntry<K,E>

java.lang.Object
org.magicwerk.brownies.collections.ImmutableMapEntry<K,E>
All Implemented Interfaces:
Map.Entry<K,E>

public class ImmutableMapEntry<K,E> extends Object implements Map.Entry<K,E>
Read-only implementation of Map.Entry.
  • Field Details

    • key

      private K key
    • value

      private E value
  • Constructor Details

    • ImmutableMapEntry

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

    • getKey

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

      public E getValue()
      Specified by:
      getValue in interface 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 Map.Entry<K,E>
    • toString

      public String toString()
      Overrides:
      toString in class Object