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

# SequencedMap


`
public


interface
SequencedMap
`


`


implements

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


`

|---|
| java.util.SequencedMap\<K, V\> |

|---|
| Known indirect subclasses [ConcurrentNavigableMap](https://developer.android.com/reference/java/util/concurrent/ConcurrentNavigableMap)\<K, V\>, [ConcurrentSkipListMap](https://developer.android.com/reference/java/util/concurrent/ConcurrentSkipListMap)\<K, V\>, [LinkedHashMap](https://developer.android.com/reference/java/util/LinkedHashMap)\<K, V\>, [NavigableMap](https://developer.android.com/reference/java/util/NavigableMap)\<K, V\>, [SortedMap](https://developer.android.com/reference/java/util/SortedMap)\<K, V\>, [TreeMap](https://developer.android.com/reference/java/util/TreeMap)\<K, V\> |---|---| | [ConcurrentNavigableMap](https://developer.android.com/reference/java/util/concurrent/ConcurrentNavigableMap)\<K, V\> | A `https://developer.android.com/reference/java/util/concurrent/ConcurrentMap` supporting `https://developer.android.com/reference/java/util/NavigableMap` operations, and recursively so for its navigable sub-maps. | | [ConcurrentSkipListMap](https://developer.android.com/reference/java/util/concurrent/ConcurrentSkipListMap)\<K, V\> | A scalable concurrent `https://developer.android.com/reference/java/util/concurrent/ConcurrentNavigableMap` implementation. | | [LinkedHashMap](https://developer.android.com/reference/java/util/LinkedHashMap)\<K, V\> | Hash table and linked list implementation of the `Map` interface, with well-defined encounter order. | | [NavigableMap](https://developer.android.com/reference/java/util/NavigableMap)\<K, V\> | A `https://developer.android.com/reference/java/util/SortedMap` extended with navigation methods returning the closest matches for given search targets. | | [SortedMap](https://developer.android.com/reference/java/util/SortedMap)\<K, V\> | A `https://developer.android.com/reference/java/util/Map` that further provides a *total ordering* on its keys. | | [TreeMap](https://developer.android.com/reference/java/util/TreeMap)\<K, V\> | A Red-Black tree based `https://developer.android.com/reference/java/util/NavigableMap` implementation. | |

<br />

*** ** * ** ***

A Map that has a well-defined encounter order, that supports operations at both ends, and
that is reversible. The [encounter order](https://developer.android.com/reference/java/util/SequencedCollection#encounter)
of a `SequencedMap` is similar to that of the elements of a `https://developer.android.com/reference/java/util/SequencedCollection`,
but the ordering applies to mappings instead of individual elements.


The bulk operations on this map, including the `https://developer.android.com/reference/java/util/Map#forEach(java.util.function.BiConsumer<?%20super%20K,?%20super%20V>)` and the
`https://developer.android.com/reference/java/util/Map#replaceAll(java.util.function.BiFunction<?%20super%20K,?%20super%20V,?%20extends%20V>)` methods, operate on this map's mappings in
encounter order.


The view collections provided by the
`https://developer.android.com/reference/java/util/Map#keySet()`,
`https://developer.android.com/reference/java/util/Map#values()`,
`https://developer.android.com/reference/java/util/Map#entrySet()`,
`https://developer.android.com/reference/java/util/SequencedMap#sequencedKeySet()`,
`https://developer.android.com/reference/java/util/SequencedMap#sequencedValues()`,
and
`https://developer.android.com/reference/java/util/SequencedMap#sequencedEntrySet()` methods all reflect the encounter order
of this map. Even though the return values of the `keySet`, `values`, and
`entrySet` methods are not sequenced *types*, the elements
in those view collections do reflect the encounter order of this map. Thus, the
iterators returned by the statements
`:
var it1 = sequencedMap.entrySet().iterator();
var it2 = sequencedMap.sequencedEntrySet().iterator();
`
both provide the mappings of `sequencedMap` in that map's encounter order.


This interface provides methods to add mappings, to retrieve mappings, and to remove
mappings at either end of the map's encounter order.


This interface also defines the `https://developer.android.com/reference/java/util/SequencedMap#reversed()` method, which provides a
reverse-ordered [view](https://developer.android.com/reference/java/util/Collection#view) of this map.
In the reverse-ordered view, the concepts of first and last are inverted, as
are the concepts of successor and predecessor. The first mapping of this map
is the last mapping of the reverse-ordered view, and vice-versa. The successor of some
mapping in this map is its predecessor in the reversed view, and vice-versa. All
methods that respect the encounter order of the map operate as if the encounter order
is inverted. For instance, the `https://developer.android.com/reference/java/util/Map#forEach(java.util.function.BiConsumer<?%20super%20K,?%20super%20V>)` method of the reversed view reports
the mappings in order from the last mapping of this map to the first. In addition, all of
the view collections of the reversed view also reflect the inverse of this map's
encounter order. For example,
`:
var itr = sequencedMap.reversed().entrySet().iterator();
`
provides the mappings of this map in the inverse of the encounter order, that is, from
the last mapping to the first mapping. The availability of the `reversed` method,
and its impact on the ordering semantics of all applicable methods and views, allow convenient
iteration, searching, copying, and streaming of this map's mappings in either forward order or
reverse order.


A map's reverse-ordered view is generally not serializable, even if the original
map is serializable.


The `https://developer.android.com/reference/java/util/Map.Entry` instances obtained by iterating the `https://developer.android.com/reference/java/util/Map#entrySet()` view, the
`https://developer.android.com/reference/java/util/SequencedMap#sequencedEntrySet()` view, and its reverse-ordered view, maintain a connection to the
underlying map. This connection is guaranteed only during the iteration. It is unspecified
whether the connection is maintained outside of the iteration. If the underlying map permits
it, calling an Entry's `https://developer.android.com/reference/java/util/Map.Entry#setValue(V)` method will modify the value of the
underlying mapping. It is, however, unspecified whether modifications to the value in the
underlying mapping are visible in the `Entry` instance.


The methods
`https://developer.android.com/reference/java/util/SequencedMap#firstEntry()`,
`https://developer.android.com/reference/java/util/SequencedMap#lastEntry()`,
`https://developer.android.com/reference/java/util/SequencedMap#pollFirstEntry()`, and
`https://developer.android.com/reference/java/util/SequencedMap#pollLastEntry()`
return `https://developer.android.com/reference/java/util/Map.Entry` instances that represent snapshots of mappings as
of the time of the call. They do *not* support mutation of the
underlying map via the optional `https://developer.android.com/reference/java/util/Map.Entry#setValue(V)` method.


Depending upon the implementation, the `Entry` instances returned by other
means might or might not be connected to the underlying map. For example, consider
an `Entry` obtained in the following manner:
`:
var entry = sequencedMap.sequencedEntrySet().getFirst();
`
It is not specified by this interface whether the `setValue` method of the
`Entry` thus obtained will update a mapping in the underlying map, or whether
it will throw an exception, or whether changes to the underlying map are visible in
that `Entry`.


This interface has the same requirements on the `equals` and `hashCode`
methods as defined by `https://developer.android.com/reference/java/util/Map#equals(java.lang.Object)` and `https://developer.android.com/reference/java/util/Map#hashCode()`.
Thus, a `Map` and a `SequencedMap` will compare equals if and only
if they have equal mappings, irrespective of ordering.


This class is a member of the
[Java Collections Framework](https://reference/java/util/package-summary.html#CollectionsFramework).

## Summary

| ### Public methods ||
|---|---|
| ` default https://developer.android.com/reference/java/util/Map.Entry<K, V>` | ` https://developer.android.com/reference/java/util/SequencedMap#firstEntry()() ` Returns the first key-value mapping in this map, or `null` if the map is empty. |
| ` default https://developer.android.com/reference/java/util/Map.Entry<K, V>` | ` https://developer.android.com/reference/java/util/SequencedMap#lastEntry()() ` Returns the last key-value mapping in this map, or `null` if the map is empty. |
| ` default https://developer.android.com/reference/java/util/Map.Entry<K, V>` | ` https://developer.android.com/reference/java/util/SequencedMap#pollFirstEntry()() ` Removes and returns the first key-value mapping in this map, or `null` if the map is empty (optional operation). |
| ` default https://developer.android.com/reference/java/util/Map.Entry<K, V>` | ` https://developer.android.com/reference/java/util/SequencedMap#pollLastEntry()() ` Removes and returns the last key-value mapping in this map, or `null` if the map is empty (optional operation). |
| ` default V` | ` https://developer.android.com/reference/java/util/SequencedMap#putFirst(K,%20V)(K k, V v) ` Inserts the given mapping into the map if it is not already present, or replaces the value of a mapping if it is already present (optional operation). |
| ` default V` | ` https://developer.android.com/reference/java/util/SequencedMap#putLast(K,%20V)(K k, V v) ` Inserts the given mapping into the map if it is not already present, or replaces the value of a mapping if it is already present (optional operation). |
| ` abstract https://developer.android.com/reference/java/util/SequencedMap<K, V>` | ` https://developer.android.com/reference/java/util/SequencedMap#reversed()() ` Returns a reverse-ordered [view](https://developer.android.com/reference/java/util/Collection#view) of this map. |
| ` default https://developer.android.com/reference/java/util/SequencedSet<https://developer.android.com/reference/java/util/Map.Entry<K, V>>` | ` https://developer.android.com/reference/java/util/SequencedMap#sequencedEntrySet()() ` Returns a `SequencedSet` view of this map's `https://developer.android.com/reference/java/util/Map#entrySet()`. |
| ` default https://developer.android.com/reference/java/util/SequencedSet<K>` | ` https://developer.android.com/reference/java/util/SequencedMap#sequencedKeySet()() ` Returns a `SequencedSet` view of this map's `https://developer.android.com/reference/java/util/Map#keySet()`. |
| ` default https://developer.android.com/reference/java/util/SequencedCollection<V>` | ` https://developer.android.com/reference/java/util/SequencedMap#sequencedValues()() ` Returns a `SequencedCollection` view of this map's `https://developer.android.com/reference/java/util/Map#values()` collection. |

| ### Inherited methods |
|---|---|
| From interface ` https://developer.android.com/reference/java/util/Map ` |---|---| | ` abstract void` | ` https://developer.android.com/reference/java/util/Map#clear()() ` Removes all of the mappings from this map (optional operation). | | ` default V` | ` https://developer.android.com/reference/java/util/Map#compute(K,%20java.util.function.BiFunction<?%20super%20K,?%20super%20V,?%20extends%20V>)(K key, https://developer.android.com/reference/java/util/function/BiFunction<? super K, ? super V, ? extends V> remappingFunction) ` Attempts to compute a mapping for the specified key and its current mapped value, or `null` if there is no current mapping (optional operation). | | ` default V` | ` https://developer.android.com/reference/java/util/Map#computeIfAbsent(K,%20java.util.function.Function<?%20super%20K,?%20extends%20V>)(K key, https://developer.android.com/reference/java/util/function/Function<? super K, ? extends V> mappingFunction) ` If the specified key is not already associated with a value (or is mapped to `null`), attempts to compute its value using the given mapping function and enters it into this map unless `null` (optional operation). | | ` default V` | ` https://developer.android.com/reference/java/util/Map#computeIfPresent(K,%20java.util.function.BiFunction<?%20super%20K,?%20super%20V,?%20extends%20V>)(K key, https://developer.android.com/reference/java/util/function/BiFunction<? super K, ? super V, ? extends V> remappingFunction) ` If the value for the specified key is present and non-null, attempts to compute a new mapping given the key and its current mapped value (optional operation). | | ` abstract boolean` | ` https://developer.android.com/reference/java/util/Map#containsKey(java.lang.Object)(https://developer.android.com/reference/java/lang/Object key) ` Returns `true` if this map contains a mapping for the specified key. | | ` abstract boolean` | ` https://developer.android.com/reference/java/util/Map#containsValue(java.lang.Object)(https://developer.android.com/reference/java/lang/Object value) ` Returns `true` if this map maps one or more keys to the specified value. | | ` static <K, V> https://developer.android.com/reference/java/util/Map<K, V>` | ` https://developer.android.com/reference/java/util/Map#copyOf(java.util.Map<?%20extends%20K,?%20extends%20V>)(https://developer.android.com/reference/java/util/Map<? extends K, ? extends V> map) ` Returns an [unmodifiable Map](https://developer.android.com/reference/java/util/SequencedMap#unmodifiable) containing the entries of the given Map. | | ` static <K, V> https://developer.android.com/reference/java/util/Map.Entry<K, V>` | ` https://developer.android.com/reference/java/util/Map#entry(K,%20V)(K k, V v) ` Returns an unmodifiable `https://developer.android.com/reference/java/util/Map.Entry` containing the given key and value. | | ` abstract https://developer.android.com/reference/java/util/Set<https://developer.android.com/reference/java/util/Map.Entry<K, V>>` | ` https://developer.android.com/reference/java/util/Map#entrySet()() ` Returns a `https://developer.android.com/reference/java/util/Set` view of the mappings contained in this map. | | ` abstract boolean` | ` https://developer.android.com/reference/java/util/Map#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object o) ` Compares the specified object with this map for equality. | | ` default void` | ` https://developer.android.com/reference/java/util/Map#forEach(java.util.function.BiConsumer<?%20super%20K,?%20super%20V>)(https://developer.android.com/reference/java/util/function/BiConsumer<? super K, ? super V> action) ` Performs the given action for each entry in this map until all entries have been processed or the action throws an exception. | | ` abstract V` | ` https://developer.android.com/reference/java/util/Map#get(java.lang.Object)(https://developer.android.com/reference/java/lang/Object key) ` Returns the value to which the specified key is mapped, or `null` if this map contains no mapping for the key. | | ` default V` | ` https://developer.android.com/reference/java/util/Map#getOrDefault(java.lang.Object,%20V)(https://developer.android.com/reference/java/lang/Object key, V defaultValue) ` Returns the value to which the specified key is mapped, or `defaultValue` if this map contains no mapping for the key. | | ` abstract int` | ` https://developer.android.com/reference/java/util/Map#hashCode()() ` Returns the hash code value for this map. | | ` abstract boolean` | ` https://developer.android.com/reference/java/util/Map#isEmpty()() ` Returns `true` if this map contains no key-value mappings. | | ` abstract https://developer.android.com/reference/java/util/Set<K>` | ` https://developer.android.com/reference/java/util/Map#keySet()() ` Returns a `https://developer.android.com/reference/java/util/Set` view of the keys contained in this map. | | ` default V` | ` https://developer.android.com/reference/java/util/Map#merge(K,%20V,%20java.util.function.BiFunction<?%20super%20V,?%20super%20V,?%20extends%20V>)(K key, V value, https://developer.android.com/reference/java/util/function/BiFunction<? super V, ? super V, ? extends V> remappingFunction) ` If the specified key is not already associated with a value or is associated with null, associates it with the given non-null value (optional operation). | | ` static <K, V> https://developer.android.com/reference/java/util/Map<K, V>` | ` https://developer.android.com/reference/java/util/Map#of(K,%20V,%20K,%20V,%20K,%20V,%20K,%20V,%20K,%20V)(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5) ` Returns an unmodifiable map containing five mappings. | | ` static <K, V> https://developer.android.com/reference/java/util/Map<K, V>` | ` https://developer.android.com/reference/java/util/Map#of(K,%20V,%20K,%20V,%20K,%20V,%20K,%20V)(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4) ` Returns an unmodifiable map containing four mappings. | | ` static <K, V> https://developer.android.com/reference/java/util/Map<K, V>` | ` https://developer.android.com/reference/java/util/Map#of(K,%20V)(K k1, V v1) ` Returns an unmodifiable map containing a single mapping. | | ` static <K, V> https://developer.android.com/reference/java/util/Map<K, V>` | ` https://developer.android.com/reference/java/util/Map#of(K,%20V,%20K,%20V,%20K,%20V,%20K,%20V,%20K,%20V,%20K,%20V,%20K,%20V,%20K,%20V)(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7, K k8, V v8) ` Returns an unmodifiable map containing eight mappings. | | ` static <K, V> https://developer.android.com/reference/java/util/Map<K, V>` | ` https://developer.android.com/reference/java/util/Map#of(K,%20V,%20K,%20V)(K k1, V v1, K k2, V v2) ` Returns an unmodifiable map containing two mappings. | | ` static <K, V> https://developer.android.com/reference/java/util/Map<K, V>` | ` https://developer.android.com/reference/java/util/Map#of(K,%20V,%20K,%20V,%20K,%20V)(K k1, V v1, K k2, V v2, K k3, V v3) ` Returns an unmodifiable map containing three mappings. | | ` static <K, V> https://developer.android.com/reference/java/util/Map<K, V>` | ` https://developer.android.com/reference/java/util/Map#of()() ` Returns an unmodifiable map containing zero mappings. | | ` static <K, V> https://developer.android.com/reference/java/util/Map<K, V>` | ` https://developer.android.com/reference/java/util/Map#of(K,%20V,%20K,%20V,%20K,%20V,%20K,%20V,%20K,%20V,%20K,%20V,%20K,%20V,%20K,%20V,%20K,%20V)(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7, K k8, V v8, K k9, V v9) ` Returns an unmodifiable map containing nine mappings. | | ` static <K, V> https://developer.android.com/reference/java/util/Map<K, V>` | ` https://developer.android.com/reference/java/util/Map#of(K,%20V,%20K,%20V,%20K,%20V,%20K,%20V,%20K,%20V,%20K,%20V)(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6) ` Returns an unmodifiable map containing six mappings. | | ` static <K, V> https://developer.android.com/reference/java/util/Map<K, V>` | ` https://developer.android.com/reference/java/util/Map#of(K,%20V,%20K,%20V,%20K,%20V,%20K,%20V,%20K,%20V,%20K,%20V,%20K,%20V)(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7) ` Returns an unmodifiable map containing seven mappings. | | ` static <K, V> https://developer.android.com/reference/java/util/Map<K, V>` | ` https://developer.android.com/reference/java/util/Map#of(K,%20V,%20K,%20V,%20K,%20V,%20K,%20V,%20K,%20V,%20K,%20V,%20K,%20V,%20K,%20V,%20K,%20V,%20K,%20V)(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7, K k8, V v8, K k9, V v9, K k10, V v10) ` Returns an unmodifiable map containing ten mappings. | | ` static <K, V> https://developer.android.com/reference/java/util/Map<K, V>` | ` https://developer.android.com/reference/java/util/Map#ofEntries(java.util.Map.Entry<?%20extends%20K,?%20extends%20V>[])(https://developer.android.com/reference/java/util/Map.Entry<? extends K, ? extends V> entries) ` Returns an unmodifiable map containing keys and values extracted from the given entries. | | ` abstract V` | ` https://developer.android.com/reference/java/util/Map#put(K,%20V)(K key, V value) ` Associates the specified value with the specified key in this map (optional operation). | | ` abstract void` | ` https://developer.android.com/reference/java/util/Map#putAll(java.util.Map<?%20extends%20K,?%20extends%20V>)(https://developer.android.com/reference/java/util/Map<? extends K, ? extends V> m) ` Copies all of the mappings from the specified map to this map (optional operation). | | ` default V` | ` https://developer.android.com/reference/java/util/Map#putIfAbsent(K,%20V)(K key, V value) ` If the specified key is not already associated with a value (or is mapped to `null`) associates it with the given value and returns `null`, else returns the current value (optional operation). | | ` default boolean` | ` https://developer.android.com/reference/java/util/Map#remove(java.lang.Object,%20java.lang.Object)(https://developer.android.com/reference/java/lang/Object key, https://developer.android.com/reference/java/lang/Object value) ` Removes the entry for the specified key only if it is currently mapped to the specified value (optional operation). | | ` abstract V` | ` https://developer.android.com/reference/java/util/Map#remove(java.lang.Object)(https://developer.android.com/reference/java/lang/Object key) ` Removes the mapping for a key from this map if it is present (optional operation). | | ` default boolean` | ` https://developer.android.com/reference/java/util/Map#replace(K,%20V,%20V)(K key, V oldValue, V newValue) ` Replaces the entry for the specified key only if currently mapped to the specified value (optional operation). | | ` default V` | ` https://developer.android.com/reference/java/util/Map#replace(K,%20V)(K key, V value) ` Replaces the entry for the specified key only if it is currently mapped to some value (optional operation). | | ` default void` | ` https://developer.android.com/reference/java/util/Map#replaceAll(java.util.function.BiFunction<?%20super%20K,?%20super%20V,?%20extends%20V>)(https://developer.android.com/reference/java/util/function/BiFunction<? super K, ? super V, ? extends V> function) ` Replaces each entry's value with the result of invoking the given function on that entry until all entries have been processed or the function throws an exception (optional operation). | | ` abstract int` | ` https://developer.android.com/reference/java/util/Map#size()() ` Returns the number of key-value mappings in this map. | | ` abstract https://developer.android.com/reference/java/util/Collection<V>` | ` https://developer.android.com/reference/java/util/Map#values()() ` Returns a `https://developer.android.com/reference/java/util/Collection` view of the values contained in this map. | ||

## Public methods

### firstEntry

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

```
public Entry<K, V> firstEntry ()
```

Returns the first key-value mapping in this map,
or `null` if the map is empty.

<br />

##### Implementation Requirements:

- The implementation in this interface obtains the iterator of this map's entrySet. If the iterator has an element, it returns an unmodifiable copy of that element. Otherwise, it returns null.

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/util/Map.Entry<K, V>` | the first key-value mapping, or `null` if this map is empty <br /> |

### lastEntry

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

```
public Entry<K, V> lastEntry ()
```

Returns the last key-value mapping in this map,
or `null` if the map is empty.

<br />

##### Implementation Requirements:

- The implementation in this interface obtains the iterator of the entrySet of this map's reversed view. If the iterator has an element, it returns an unmodifiable copy of that element. Otherwise, it returns null.

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/util/Map.Entry<K, V>` | the last key-value mapping, or `null` if this map is empty <br /> |

### pollFirstEntry

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

```
public Entry<K, V> pollFirstEntry ()
```

Removes and returns the first key-value mapping in this map,
or `null` if the map is empty (optional operation).

<br />

##### Implementation Requirements:

- The implementation in this interface obtains the iterator of this map's entrySet. If the iterator has an element, it calls `remove` on the iterator and then returns an unmodifiable copy of that element. Otherwise, it returns null.

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/util/Map.Entry<K, V>` | the removed first entry of this map, or `null` if this map is empty <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/UnsupportedOperationException` | if this collection implementation does not support this operation |

### pollLastEntry

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

```
public Entry<K, V> pollLastEntry ()
```

Removes and returns the last key-value mapping in this map,
or `null` if the map is empty (optional operation).

<br />

##### Implementation Requirements:

- The implementation in this interface obtains the iterator of the entrySet of this map's reversed view. If the iterator has an element, it calls `remove` on the iterator and then returns an unmodifiable copy of that element. Otherwise, it returns null.

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/util/Map.Entry<K, V>` | the removed last entry of this map, or `null` if this map is empty <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/UnsupportedOperationException` | if this collection implementation does not support this operation |

### putFirst

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

```
public V putFirst (K k, 
                V v)
```

Inserts the given mapping into the map if it is not already present, or replaces the
value of a mapping if it is already present (optional operation). After this operation
completes normally, the given mapping will be present in this map, and it will be the
first mapping in this map's encounter order.

<br />

##### Implementation Requirements:

- The implementation in this interface always throws `UnsupportedOperationException`.

| Parameters ||
|---|---|
| `k` | `K`: the key <br /> |
| `v` | `V`: the value <br /> |

| Returns ||
|---|---|
| `V` | the value previously associated with k, or null if none <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/UnsupportedOperationException` | if this collection implementation does not support this operation |

### putLast

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

```
public V putLast (K k, 
                V v)
```

Inserts the given mapping into the map if it is not already present, or replaces the
value of a mapping if it is already present (optional operation). After this operation
completes normally, the given mapping will be present in this map, and it will be the
last mapping in this map's encounter order.

<br />

##### Implementation Requirements:

- The implementation in this interface always throws `UnsupportedOperationException`.

| Parameters ||
|---|---|
| `k` | `K`: the key <br /> |
| `v` | `V`: the value <br /> |

| Returns ||
|---|---|
| `V` | the value previously associated with k, or null if none <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/UnsupportedOperationException` | if this collection implementation does not support this operation |

### reversed

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

```
public abstract SequencedMap<K, V> reversed ()
```

Returns a reverse-ordered [view](https://developer.android.com/reference/java/util/Collection#view) of this map.
The encounter order of mappings in the returned view is the inverse of the encounter
order of mappings in this map. The reverse ordering affects all order-sensitive operations,
including those on the view collections of the returned view. If the implementation permits
modifications to this view, the modifications "write through" to the underlying map.
Changes to the underlying map might or might not be visible in this reversed view,
depending upon the implementation.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/util/SequencedMap<K, V>` | a reverse-ordered view of this map <br /> |

### sequencedEntrySet

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

```
public SequencedSet<Entry<K, V>> sequencedEntrySet ()
```

Returns a `SequencedSet` view of this map's `https://developer.android.com/reference/java/util/Map#entrySet()`.

<br />

##### Implementation Requirements:

- The implementation in this interface returns a `SequencedSet` instance that behaves as follows. Its `https://developer.android.com/reference/java/util/Set#add(E)`, `https://developer.android.com/reference/java/util/Set#addAll(java.util.Collection<?%20extends%20E>)`, `https://developer.android.com/reference/java/util/SequencedCollection#addFirst(E)`, and `https://developer.android.com/reference/java/util/SequencedCollection#addLast(E)` methods throw `https://developer.android.com/reference/java/lang/UnsupportedOperationException`. Its `https://developer.android.com/reference/java/util/SequencedCollection#getFirst()` and `https://developer.android.com/reference/java/util/SequencedCollection#getLast()` methods are implemented in terms of the `https://developer.android.com/reference/java/util/SequencedMap#firstEntry()` and `https://developer.android.com/reference/java/util/SequencedMap#lastEntry()` methods of this interface, respectively. Its `https://developer.android.com/reference/java/util/SequencedCollection#removeFirst()` and `https://developer.android.com/reference/java/util/SequencedCollection#removeLast()` methods are implemented in terms of the `https://developer.android.com/reference/java/util/SequencedMap#pollFirstEntry()` and `https://developer.android.com/reference/java/util/SequencedMap#pollLastEntry()` methods of this interface, respectively. Its `https://developer.android.com/reference/java/util/SequencedSet#reversed()` method returns the `https://developer.android.com/reference/java/util/SequencedMap#sequencedEntrySet()` view of the `https://developer.android.com/reference/java/util/SequencedMap#reversed()` view of this map. Each of its other methods calls the corresponding method of the `https://developer.android.com/reference/java/util/Map#entrySet()` view of this map.

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/util/SequencedSet<https://developer.android.com/reference/java/util/Map.Entry<K, V>>` | a `SequencedSet` view of this map's `entrySet` <br /> |

### sequencedKeySet

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

```
public SequencedSet<K> sequencedKeySet ()
```

Returns a `SequencedSet` view of this map's `https://developer.android.com/reference/java/util/Map#keySet()`.

<br />

##### Implementation Requirements:

- The implementation in this interface returns a `SequencedSet` instance that behaves as follows. Its `https://developer.android.com/reference/java/util/Set#add(E)`, `https://developer.android.com/reference/java/util/Set#addAll(java.util.Collection<?%20extends%20E>)`, `https://developer.android.com/reference/java/util/SequencedCollection#addFirst(E)`, and `https://developer.android.com/reference/java/util/SequencedCollection#addLast(E)` methods throw `https://developer.android.com/reference/java/lang/UnsupportedOperationException`. Its `https://developer.android.com/reference/java/util/SequencedCollection#getFirst()` and `https://developer.android.com/reference/java/util/SequencedCollection#getLast()` methods are implemented in terms of the `https://developer.android.com/reference/java/util/SequencedMap#firstEntry()` and `https://developer.android.com/reference/java/util/SequencedMap#lastEntry()` methods of this interface, respectively. Its `https://developer.android.com/reference/java/util/SequencedCollection#removeFirst()` and `https://developer.android.com/reference/java/util/SequencedCollection#removeLast()` methods are implemented in terms of the `https://developer.android.com/reference/java/util/SequencedMap#pollFirstEntry()` and `https://developer.android.com/reference/java/util/SequencedMap#pollLastEntry()` methods of this interface, respectively. Its `https://developer.android.com/reference/java/util/SequencedSet#reversed()` method returns the `https://developer.android.com/reference/java/util/SequencedMap#sequencedKeySet()` view of the `https://developer.android.com/reference/java/util/SequencedMap#reversed()` view of this map. Each of its other methods calls the corresponding method of the `https://developer.android.com/reference/java/util/Map#keySet()` view of this map.

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/util/SequencedSet<K>` | a `SequencedSet` view of this map's `keySet` <br /> |

### sequencedValues

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

```
public SequencedCollection<V> sequencedValues ()
```

Returns a `SequencedCollection` view of this map's `https://developer.android.com/reference/java/util/Map#values()` collection.

<br />

##### Implementation Requirements:

- The implementation in this interface returns a `SequencedCollection` instance that behaves as follows. Its `https://developer.android.com/reference/java/util/Collection#add(E)`, `https://developer.android.com/reference/java/util/Collection#addAll(java.util.Collection<?%20extends%20E>)`, `https://developer.android.com/reference/java/util/SequencedCollection#addFirst(E)`, and `https://developer.android.com/reference/java/util/SequencedCollection#addLast(E)` methods throw `https://developer.android.com/reference/java/lang/UnsupportedOperationException`. Its `https://developer.android.com/reference/java/util/SequencedCollection#getFirst()` and `https://developer.android.com/reference/java/util/SequencedCollection#getLast()` methods are implemented in terms of the `https://developer.android.com/reference/java/util/SequencedMap#firstEntry()` and `https://developer.android.com/reference/java/util/SequencedMap#lastEntry()` methods of this interface, respectively. Its `https://developer.android.com/reference/java/util/SequencedCollection#removeFirst()` and `https://developer.android.com/reference/java/util/SequencedCollection#removeLast()` methods are implemented in terms of the `https://developer.android.com/reference/java/util/SequencedMap#pollFirstEntry()` and `https://developer.android.com/reference/java/util/SequencedMap#pollLastEntry()` methods of this interface, respectively. Its `https://developer.android.com/reference/java/util/SequencedCollection#reversed()` method returns the `https://developer.android.com/reference/java/util/SequencedMap#sequencedValues()` view of the `https://developer.android.com/reference/java/util/SequencedMap#reversed()` view of this map. Its `https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)` and `https://developer.android.com/reference/java/lang/Object#hashCode()` methods are inherited from `https://developer.android.com/reference/java/lang/Object`. Each of its other methods calls the corresponding method of the `https://developer.android.com/reference/java/util/Map#values()` view of this map.

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/util/SequencedCollection<V>` | a `SequencedCollection` view of this map's `values` collection <br /> |