Class AbstractMap.SimpleImmutableEntry<K,V>

java.lang.Object
java.util.AbstractMap.SimpleImmutableEntry<K,V>
All Implemented Interfaces:
Map.Entry<K,V>
Enclosing class:
AbstractMap<K,V>

public static class AbstractMap.SimpleImmutableEntry<K,V> extends Object implements Map.Entry<K,V>

An immutable key-value mapping.

Type parameter K: the type of key Type parameter V: the type of value

Since

1.6

  • Constructor Details

    • SimpleImmutableEntry

      public SimpleImmutableEntry(K theKey, V theValue)

      Constructs a new instance by key and value.

      Parameters
      • theKey: the key

      • theValue: the value

    • SimpleImmutableEntry

      public SimpleImmutableEntry(Map.Entry<? extends K, ? extends V> entry)

      Constructs a new instance by an entry

      Parameters
      • entry: the entry
  • Method Details

    • getKey

      public K getKey()

      Returns the key.

      Returns

      the key

      See also
      • java.util.Map.Entry#getKey()
      Specified by:
      getKey in interface Map.Entry<K,V>
    • getValue

      public V getValue()

      Returns the value.

      Returns

      the value

      See also
      • java.util.Map.Entry#getValue()
      Specified by:
      getValue in interface Map.Entry<K,V>
    • setValue

      public V setValue(V object)

      Throws an UnsupportedOperationException.

      Parameters
      • object: new value
      Returns

      (Does not)

      Throws
      • UnsupportedOperationException: always
      See also
      • java.util.Map.Entry#setValue(java.lang.Object)
      Specified by:
      setValue in interface Map.Entry<K,V>
    • equals

      public boolean equals(Object object)

      Answers whether the object is equal to this entry. This works across all kinds of the Map.Entry interface.

      See also
      • java.lang.Object#equals(java.lang.Object)
      Specified by:
      equals in interface Map.Entry<K,V>
      Overrides:
      equals in class Object
      Returns:

      true if the specified Object is equal to this Map.Entry, false otherwise.

      See also
      • #hashCode()
    • hashCode

      public int hashCode()

      Answers the hash code of this entry.

      See also
      • java.lang.Object#hashCode()
      Specified by:
      hashCode in interface Map.Entry<K,V>
      Overrides:
      hashCode in class Object
    • toString

      public String toString()

      Answers a String representation of this entry.

      See also
      • java.lang.Object#toString()
      Overrides:
      toString in class Object