Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Ctors](https://developer.android.com/reference/java/util/AbstractMap.SimpleEntry#pubctors) \| [Methods](https://developer.android.com/reference/java/util/AbstractMap.SimpleEntry#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/java/util/AbstractMap.SimpleEntry#inhmethods)

# AbstractMap.SimpleEntry


`
public
static


class
AbstractMap.SimpleEntry
`


`

extends https://developer.android.com/reference/java/lang/Object


`

`


implements

https://developer.android.com/reference/java/util/Map.Entry<K, V>,

https://developer.android.com/reference/java/io/Serializable


`

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | java.util.AbstractMap.SimpleEntry\<K, V\> |

<br />

*** ** * ** ***

An Entry maintaining a key and a value. The value may be
changed using the `setValue` method. Instances of
this class are not associated with any map nor with any
map's entry-set view.

## Summary

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/java/util/AbstractMap.SimpleEntry#SimpleEntry(java.util.Map.Entry<?%20extends%20K,?%20extends%20V>)(https://developer.android.com/reference/java/util/Map.Entry<? extends K, ? extends V> entry) ` Creates an entry representing the same mapping as the specified entry. |
| ` https://developer.android.com/reference/java/util/AbstractMap.SimpleEntry#SimpleEntry(K,%20V)(K key, V value) ` Creates an entry representing a mapping from the specified key to the specified value. |

| ### Public methods ||
|---|---|
| ` boolean` | ` https://developer.android.com/reference/java/util/AbstractMap.SimpleEntry#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object o) ` Compares the specified object with this entry for equality. |
| ` K` | ` https://developer.android.com/reference/java/util/AbstractMap.SimpleEntry#getKey()() ` Returns the key corresponding to this entry. |
| ` V` | ` https://developer.android.com/reference/java/util/AbstractMap.SimpleEntry#getValue()() ` Returns the value corresponding to this entry. |
| ` int` | ` https://developer.android.com/reference/java/util/AbstractMap.SimpleEntry#hashCode()() ` Returns the hash code value for this map entry. |
| ` V` | ` https://developer.android.com/reference/java/util/AbstractMap.SimpleEntry#setValue(V)(V value) ` Replaces the value corresponding to this entry with the specified value. |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/java/util/AbstractMap.SimpleEntry#toString()() ` Returns a String representation of this map entry. |

| ### Inherited methods |
|---|---|
| From class ` https://developer.android.com/reference/java/lang/Object ` |---|---| | ` https://developer.android.com/reference/java/lang/Object` | ` https://developer.android.com/reference/java/lang/Object#clone()() ` Creates and returns a copy of this object. | | ` boolean` | ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) ` Indicates whether some other object is "equal to" this one. | | ` void` | ` https://developer.android.com/reference/java/lang/Object#finalize()() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. | | ` final https://developer.android.com/reference/java/lang/Class<?>` | ` https://developer.android.com/reference/java/lang/Object#getClass()() ` Returns the runtime class of this `Object`. | | ` int` | ` https://developer.android.com/reference/java/lang/Object#hashCode()() ` Returns a hash code value for the object. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notify()() ` Wakes up a single thread that is waiting on this object's monitor. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notifyAll()() ` Wakes up all threads that are waiting on this object's monitor. | | ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/java/lang/Object#toString()() ` Returns a string representation of the object. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait()() ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*. | ||
| From interface ` https://developer.android.com/reference/java/util/Map.Entry ` |---|---| | ` static <K, V> https://developer.android.com/reference/java/util/Comparator<https://developer.android.com/reference/java/util/Map.Entry<K, V>>` | ` https://developer.android.com/reference/java/util/Map.Entry#comparingByKey(java.util.Comparator<?%20super%20K>)(https://developer.android.com/reference/java/util/Comparator<? super K> cmp) ` Returns a comparator that compares `https://developer.android.com/reference/java/util/Map.Entry` by key using the given `https://developer.android.com/reference/java/util/Comparator`. | | ` static <K extends https://developer.android.com/reference/java/lang/Comparable<? super K>, V> https://developer.android.com/reference/java/util/Comparator<https://developer.android.com/reference/java/util/Map.Entry<K, V>>` | ` https://developer.android.com/reference/java/util/Map.Entry#comparingByKey()() ` Returns a comparator that compares `https://developer.android.com/reference/java/util/Map.Entry` in natural order on key. | | ` static <K, V> https://developer.android.com/reference/java/util/Comparator<https://developer.android.com/reference/java/util/Map.Entry<K, V>>` | ` https://developer.android.com/reference/java/util/Map.Entry#comparingByValue(java.util.Comparator<?%20super%20V>)(https://developer.android.com/reference/java/util/Comparator<? super V> cmp) ` Returns a comparator that compares `https://developer.android.com/reference/java/util/Map.Entry` by value using the given `https://developer.android.com/reference/java/util/Comparator`. | | ` static <K, V extends https://developer.android.com/reference/java/lang/Comparable<? super V>> https://developer.android.com/reference/java/util/Comparator<https://developer.android.com/reference/java/util/Map.Entry<K, V>>` | ` https://developer.android.com/reference/java/util/Map.Entry#comparingByValue()() ` Returns a comparator that compares `https://developer.android.com/reference/java/util/Map.Entry` in natural order on value. | | ` static <K, V> https://developer.android.com/reference/java/util/Map.Entry<K, V>` | ` https://developer.android.com/reference/java/util/Map.Entry#copyOf(java.util.Map.Entry<?%20extends%20K,?%20extends%20V>)(https://developer.android.com/reference/java/util/Map.Entry<? extends K, ? extends V> e) ` Returns a copy of the given `Map.Entry`. | | ` abstract boolean` | ` https://developer.android.com/reference/java/util/Map.Entry#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object o) ` Compares the specified object with this entry for equality. | | ` abstract K` | ` https://developer.android.com/reference/java/util/Map.Entry#getKey()() ` Returns the key corresponding to this entry. | | ` abstract V` | ` https://developer.android.com/reference/java/util/Map.Entry#getValue()() ` Returns the value corresponding to this entry. | | ` abstract int` | ` https://developer.android.com/reference/java/util/Map.Entry#hashCode()() ` Returns the hash code value for this map entry. | | ` abstract V` | ` https://developer.android.com/reference/java/util/Map.Entry#setValue(V)(V value) ` Replaces the value corresponding to this entry with the specified value (optional operation). | ||

## Public constructors

### SimpleEntry

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public SimpleEntry (Entry<? extends K, ? extends V> entry)
```

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

<br />

| Parameters ||
|---|---|
| `entry` | `Entry`: the entry to copy <br /> |

### SimpleEntry

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public SimpleEntry (K key, 
                V value)
```

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

<br />

| Parameters ||
|---|---|
| `key` | `K`: the key represented by this entry <br /> |
| `value` | `V`: the value represented by this entry <br /> |

## Public methods

### equals

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean equals (Object 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 />

<br />

| Parameters ||
|---|---|
| `o` | `Object`: object to be compared for equality with this map entry <br /> |

| Returns ||
|---|---|
| `boolean` | `true` if the specified object is equal to this map entry <br /> |

**See also:**

- `https://developer.android.com/reference/java/util/AbstractMap.SimpleEntry#hashCode()`

### getKey

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public K getKey ()
```

Returns the key corresponding to this entry.

<br />

| Returns ||
|---|---|
| `K` | the key corresponding to this entry <br /> |

### getValue

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public V getValue ()
```

Returns the value corresponding to this entry.

<br />

| Returns ||
|---|---|
| `V` | the value corresponding to this entry <br /> |

### hashCode

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
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://developer.android.com/reference/java/lang/Object#hashCode()`.

<br />

<br />

| Returns ||
|---|---|
| `int` | the hash code value for this map entry <br /> |

**See also:**

- `https://developer.android.com/reference/java/util/AbstractMap.SimpleEntry#equals(java.lang.Object)`

### setValue

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public V setValue (V value)
```

Replaces the value corresponding to this entry with the specified
value.

<br />

| Parameters ||
|---|---|
| `value` | `V`: new value to be stored in this entry <br /> |

| Returns ||
|---|---|
| `V` | the old value corresponding to the entry <br /> |

### toString

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public String 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.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | a String representation of this map entry <br /> |