# AbstractMap.SimpleImmutableEntry

public static class **AbstractMap.SimpleImmutableEntry** extends [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)  
implements [Entry](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Map.Entry.html)\<K, V\> [Serializable](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/Serializable.html) An Entry maintaining an immutable key and value. This class
does not support method setValue. This class may be
convenient in methods that return thread-safe snapshots of
key-value mappings.

### Public Constructor Summary

|---|---|
|   | [SimpleImmutableEntry](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/AbstractMap.SimpleImmutableEntry.html#SimpleImmutableEntry(K,%20V))(K key, V value) Creates an entry representing a mapping from the specified key to the specified value. |
|   | [SimpleImmutableEntry](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/AbstractMap.SimpleImmutableEntry.html#SimpleImmutableEntry(java.util.Map.Entry<?%20extends%20K,%20?%20extends%20V>))([Entry](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Map.Entry.html)\<? extends K, ? extends V\> entry) Creates an entry representing the same mapping as the specified entry. |

### Public Method Summary

|---|---|
| boolean | [equals](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/AbstractMap.SimpleImmutableEntry.html#equals(java.lang.Object))([Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) o) Compares the specified object with this entry for equality. |
| K | [getKey](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/AbstractMap.SimpleImmutableEntry.html#getKey())() Returns the key corresponding to this entry. |
| V | [getValue](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/AbstractMap.SimpleImmutableEntry.html#getValue())() Returns the value corresponding to this entry. |
| int | [hashCode](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/AbstractMap.SimpleImmutableEntry.html#hashCode())() Returns the hash code value for this map entry. |
| V | [setValue](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/AbstractMap.SimpleImmutableEntry.html#setValue(V))(V value) Replaces the value corresponding to this entry with the specified value (optional operation). |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [toString](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/AbstractMap.SimpleImmutableEntry.html#toString())() Returns a String representation of this map entry. |

### Inherited Method Summary

From class [java.lang.Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)

|---|---|
| [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) | [clone](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#clone())() Creates and returns a copy of this `Object`. |
| boolean | [equals](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#equals(java.lang.Object))([Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) obj) Compares this instance with the specified object and indicates if they are equal. |
| void | [finalize](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#finalize())() Invoked when the garbage collector has detected that this instance is no longer reachable. |
| final [Class](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html)\<?\> | [getClass](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#getClass())() Returns the unique instance of `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html` that represents this object's class. |
| int | [hashCode](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#hashCode())() Returns an integer hash code for this object. |
| final void | [notify](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#notify())() Causes a thread which is waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |
| final void | [notifyAll](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#notifyAll())() Causes all threads which are waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [toString](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#toString())() Returns a string containing a concise, human-readable description of this object. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait(long,%20int))(long timeout, int nanos) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait(long))(long timeout) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait())() Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object. |

From interface [java.util.Map.Entry](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Map.Entry.html)

|---|---|
| static \<K, V\> [Comparator](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Comparator.html)\<[Entry](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Map.Entry.html)\<K, V\>\> | [comparingByKey](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Map.Entry.html#comparingByKey(java.util.Comparator<?%20super%20K>))([Comparator](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Comparator.html)\<? super K\> cmp) Returns a comparator that compares `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Map.Entry.html` by key using the given `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Comparator.html`. |
| static \<K extends [Comparable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Comparable.html)\<? super K\>, V\> [Comparator](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Comparator.html)\<[Entry](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Map.Entry.html)\<K, V\>\> | [comparingByKey](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Map.Entry.html#comparingByKey())() Returns a comparator that compares `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Map.Entry.html` in natural order on key. |
| static \<K, V\> [Comparator](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Comparator.html)\<[Entry](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Map.Entry.html)\<K, V\>\> | [comparingByValue](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Map.Entry.html#comparingByValue(java.util.Comparator<?%20super%20V>))([Comparator](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Comparator.html)\<? super V\> cmp) Returns a comparator that compares `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Map.Entry.html` by value using the given `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Comparator.html`. |
| static \<K, V extends [Comparable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Comparable.html)\<? super V\>\> [Comparator](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Comparator.html)\<[Entry](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Map.Entry.html)\<K, V\>\> | [comparingByValue](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Map.Entry.html#comparingByValue())() Returns a comparator that compares `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Map.Entry.html` in natural order on value. |
| abstract boolean | [equals](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Map.Entry.html#equals(java.lang.Object))([Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) o) Compares the specified object with this entry for equality. |
| abstract K | [getKey](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Map.Entry.html#getKey())() Returns the key corresponding to this entry. |
| abstract V | [getValue](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Map.Entry.html#getValue())() Returns the value corresponding to this entry. |
| abstract int | [hashCode](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Map.Entry.html#hashCode())() Returns the hash code value for this map entry. |
| abstract V | [setValue](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Map.Entry.html#setValue(V))(V value) Replaces the value corresponding to this entry with the specified value (optional operation). |

## Public Constructors

#### public
**SimpleImmutableEntry**
(K key, V value)

Creates an entry representing a mapping from the specified
key to the specified value.

##### Parameters

| key | the key represented by this entry |
| value | the value represented by this entry |
|---|---|

#### public
**SimpleImmutableEntry**
([Entry](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Map.Entry.html)\<? extends K, ? extends V\> entry)

Creates an entry representing the same mapping as the
specified entry.

##### Parameters

| entry | the entry to copy |
|---|---|

## Public Methods

#### public boolean
**equals**
([Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) o)

Compares the specified object with this entry for equality.
Returns `true` if the given object is also a map entry and
the two entries represent the same mapping. More formally, two
entries `e1` and `e2` represent the same mapping
if

```
   (e1.getKey()==null ?
    e2.getKey()==null :
    e1.getKey().equals(e2.getKey()))
   &&
   (e1.getValue()==null ?
    e2.getValue()==null :
    e1.getValue().equals(e2.getValue()))
```
This ensures that the `equals` method works properly across different implementations of the `Map.Entry` interface.

<br />

##### Parameters

| o | object to be compared for equality with this map entry |
|---|---|

##### Returns

- `true` if the specified object is equal to this map entry

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/AbstractMap.SimpleImmutableEntry.html#hashCode()`

#### public K
**getKey**
()

Returns the key corresponding to this entry.

##### Returns

- the key corresponding to this entry

#### public V
**getValue**
()

Returns the value corresponding to this entry.

##### Returns

- the value corresponding to this entry

#### public int
**hashCode**
()

Returns the hash code value for this map entry. The hash code
of a map entry `e` is defined to be:

```
   (e.getKey()==null   ? 0 : e.getKey().hashCode()) ^
   (e.getValue()==null ? 0 : e.getValue().hashCode())
```
This ensures that `e1.equals(e2)` implies that `e1.hashCode()==e2.hashCode()` for any two Entries `e1` and `e2`, as required by the general contract of `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#hashCode()`.

<br />

##### Returns

- the hash code value for this map entry

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/AbstractMap.SimpleImmutableEntry.html#equals(java.lang.Object)`

#### public V
**setValue**
(V value)

Replaces the value corresponding to this entry with the specified
value (optional operation). This implementation simply throws
UnsupportedOperationException, as this class implements
an *immutable* map entry.

##### Parameters

| value | new value to be stored in this entry |
|---|---|

##### Returns

- (Does not return)

##### Throws

| [UnsupportedOperationException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/UnsupportedOperationException.html) | always |
|---|---|

#### public [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)
**toString**
()

Returns a String representation of this map entry. This
implementation returns the string representation of this
entry's key followed by the equals character ("=")
followed by the string representation of this entry's value.

##### Returns

- a String representation of this map entry