public static class AbstractMap.SimpleImmutableEntry<K, V>

  1. Object
  2. AbstractMap.SimpleImmutableEntry

ImplementsMap.Entry<K, V>

An immutable key-value mapping.

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

Constructors

public SimpleImmutableEntry(K theKey, V theValue)Constructs a new instance by key and value.
public SimpleImmutableEntry(Map.Entry<? extends K, ? extends V> entry)Constructs a new instance by an entry

Methods

public K getKey()Returns the key.
public V getValue()Returns the value.
public V setValue(V object)Throws an UnsupportedOperationException.
public boolean equals(Object object)Answers whether the object is equal to this entry.
public int hashCode()Answers the hash code of this entry.
public String toString()Answers a String representation of this entry.

Inherited methods

Constructor details

SimpleImmutableEntry

public SimpleImmutableEntry(K theKey, V theValue)
Constructs a new instance by key and value.

Parameters

theKey K
the key
theValue V
the value

SimpleImmutableEntry

public SimpleImmutableEntry(Map.Entry<? extends K, ? extends V> entry)
Constructs a new instance by an entry

Parameters

entry Map.Entry<? extends K, ? extends V>
the entry

Method details

getKey

public K getKey()
Returns the key.

Returns

the key

getValue

public V getValue()
Returns the value.

Returns

the value

setValue

public V setValue(V object)
Throws an UnsupportedOperationException.

Parameters

object V
new value

Returns

(Does not)

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.

hashCode

public int hashCode()
Answers the hash code of this entry.

toString

public String toString()
Answers a String representation of this entry.