| <html devsite="true"> |
| <head> |
| <title>SimpleArrayMap</title> |
| {% setvar book_path %}/reference/androidx/_book.yaml{% endsetvar %} |
| {% include "_shared/_reference-head-tags.html" %} |
| </head> |
| <body> |
| <div itemscope="" itemtype="http://developers.google.com/ReferenceObject"> |
| <meta itemprop="name" content="SimpleArrayMap"> |
| <meta itemprop="path" content="androidx.collection"> |
| <meta itemprop="property" content="clear()"> |
| <meta itemprop="property" content="containsKey(kotlin.Any)"> |
| <meta itemprop="property" content="containsValue(kotlin.Any)"> |
| <meta itemprop="property" content="ensureCapacity(kotlin.Int)"> |
| <meta itemprop="property" content="equals(kotlin.Any)"> |
| <meta itemprop="property" content="get(kotlin.Any)"> |
| <meta itemprop="property" content="getOrDefault(kotlin.Any,kotlin.Any)"> |
| <meta itemprop="property" content="hashCode()"> |
| <meta itemprop="property" content="indexOfKey(kotlin.Any)"> |
| <meta itemprop="property" content="isEmpty()"> |
| <meta itemprop="property" content="keyAt(kotlin.Int)"> |
| <meta itemprop="property" content="put(kotlin.Any,kotlin.Any)"> |
| <meta itemprop="property" content="putAll(androidx.collection.SimpleArrayMap)"> |
| <meta itemprop="property" content="putIfAbsent(kotlin.Any,kotlin.Any)"> |
| <meta itemprop="property" content="remove(kotlin.Any)"> |
| <meta itemprop="property" content="remove(kotlin.Any,kotlin.Any)"> |
| <meta itemprop="property" content="removeAt(kotlin.Int)"> |
| <meta itemprop="property" content="replace(kotlin.Any,kotlin.Any)"> |
| <meta itemprop="property" content="replace(kotlin.Any,kotlin.Any,kotlin.Any)"> |
| <meta itemprop="property" content="setValueAt(kotlin.Int,kotlin.Any)"> |
| <meta itemprop="property" content="size()"> |
| <meta itemprop="property" content="toString()"> |
| <meta itemprop="property" content="valueAt(kotlin.Int)"> |
| <meta itemprop="language" content="JAVA"> |
| </div> |
| <div id="header-block"> |
| <div> |
| <h1>SimpleArrayMap</h1> |
| </div> |
| <div id="metadata-info-block"> |
| <div id="source-link"><a href="https://cs.android.com/search?q=file:androidx/collection/SimpleArrayMap.kt+class:androidx.collection.SimpleArrayMap&ss=androidx/platform/frameworks/support" class="external">View Source</a></div> |
| </div> |
| </div> |
| <div id="refdoc-switcher-placeholder"></div> |
| <p> |
| <pre>public class <a href="/reference/androidx/collection/SimpleArrayMap.html">SimpleArrayMap</a><K extends <a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>, V extends <a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>></pre> |
| </p> |
| <div class="devsite-table-wrapper"><devsite-expandable><span class="expand-control jd-sumtable-subclasses">Known direct subclasses |
| <div class="showalways" id="subclasses-direct"><a href="/reference/androidx/collection/ArrayMap.html">ArrayMap</a></div> |
| </span> |
| <div id="subclasses-direct-summary"> |
| <div class="devsite-table-wrapper"> |
| <table class="responsive"> |
| <colgroup> |
| <col width="40%"> |
| <col> |
| </colgroup> |
| <tbody class="list"> |
| <tr> |
| <td><code><a href="/reference/androidx/collection/ArrayMap.html">ArrayMap</a></code></td> |
| <td> |
| <p>ArrayMap is a generic key->value mapping data structure that is designed to be more memory efficient than a traditional <code><a href="https://developer.android.com/reference/java/util/HashMap.html">java.util.HashMap</a></code>, this implementation is a version of the platform's <code>android.util.ArrayMap</code> that can be used on older versions of the platform.</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| </div> |
| </devsite-expandable> </div> |
| <hr> |
| <p>Base implementation of androidx.collection.ArrayMap that doesn't include any standard Java container API interoperability. These features are generally heavier-weight ways to interact with the container, so discouraged, but they can be useful to make it easier to use as a drop-in replacement for HashMap. If you don't need them, this class can be preferable since it doesn't bring in any of the implementation of those APIs, allowing that code to be stripped by ProGuard.</p> |
| <h2>Summary</h2> |
| <div class="devsite-table-wrapper"> |
| <table class="responsive"> |
| <colgroup> |
| <col width="40%"> |
| <col> |
| </colgroup> |
| <thead> |
| <tr> |
| <th colspan="100%"><h3>Public constructors</h3></th> |
| </tr> |
| </thead> |
| <tbody class="list"> |
| <tr> |
| <td> |
| <div><code><K extends <a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>, V extends <a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>> <a href="/reference/androidx/collection/SimpleArrayMap.html#SimpleArrayMap(kotlin.Int)">SimpleArrayMap</a>(int capacity)</code></div> |
| <p>Create a new <code><a href="/reference/androidx/collection/SimpleArrayMap.html">SimpleArrayMap</a></code> with a given initial capacity.</p> |
| </td> |
| </tr> |
| <tr> |
| <td> |
| <div><code><K extends <a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>, V extends <a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>> <a href="/reference/androidx/collection/SimpleArrayMap.html#SimpleArrayMap(androidx.collection.SimpleArrayMap)">SimpleArrayMap</a>(<br> <a href="/reference/androidx/collection/SimpleArrayMap.html">SimpleArrayMap</a><@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> K, @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> V> map<br>)</code></div> |
| <p>Create a new <code><a href="/reference/androidx/collection/SimpleArrayMap.html">SimpleArrayMap</a></code> with the mappings from the given <code><a href="/reference/androidx/collection/SimpleArrayMap.html#<init>(androidx.collection.SimpleArrayMap)">map</a></code>.</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| <div class="devsite-table-wrapper"> |
| <table class="responsive"> |
| <colgroup> |
| <col width="40%"> |
| <col> |
| </colgroup> |
| <thead> |
| <tr> |
| <th colspan="100%"><h3>Public methods</h3></th> |
| </tr> |
| </thead> |
| <tbody class="list"> |
| <tr> |
| <td><code>void</code></td> |
| <td> |
| <div><code><a href="/reference/androidx/collection/SimpleArrayMap.html#clear()">clear</a>()</code></div> |
| <p>Make the array map empty.</p> |
| </td> |
| </tr> |
| <tr> |
| <td><code>boolean</code></td> |
| <td> |
| <div><code><a href="/reference/androidx/collection/SimpleArrayMap.html#containsKey(kotlin.Any)">containsKey</a>(@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> K key)</code></div> |
| <p>Check whether a key exists in the array.</p> |
| </td> |
| </tr> |
| <tr> |
| <td><code>boolean</code></td> |
| <td> |
| <div><code><a href="/reference/androidx/collection/SimpleArrayMap.html#containsValue(kotlin.Any)">containsValue</a>(@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> V value)</code></div> |
| <p>Check whether a value exists in the array.</p> |
| </td> |
| </tr> |
| <tr> |
| <td><code>void</code></td> |
| <td> |
| <div><code><a href="/reference/androidx/collection/SimpleArrayMap.html#ensureCapacity(kotlin.Int)">ensureCapacity</a>(int minimumCapacity)</code></div> |
| <p>Ensure the array map can hold at least <code><a href="/reference/androidx/collection/SimpleArrayMap.html#ensureCapacity(kotlin.Int)">minimumCapacity</a></code> items.</p> |
| </td> |
| </tr> |
| <tr> |
| <td><code>boolean</code></td> |
| <td> |
| <div><code><a href="/reference/androidx/collection/SimpleArrayMap.html#equals(kotlin.Any)">equals</a>(<a href="https://developer.android.com/reference/java/lang/Object.html">Object</a> other)</code></div> |
| <p>This implementation returns <code>false</code> if the object is not a <code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-map/index.html">Map</a></code> or <code><a href="/reference/androidx/collection/SimpleArrayMap.html">SimpleArrayMap</a></code>, or if the maps have different sizes.</p> |
| </td> |
| </tr> |
| <tr> |
| <td><code>V</code></td> |
| <td> |
| <div><code><a href="/reference/androidx/collection/SimpleArrayMap.html#get(kotlin.Any)">get</a>(@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> K key)</code></div> |
| <p>Retrieve a value from the array.</p> |
| </td> |
| </tr> |
| <tr> |
| <td><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> V</code></td> |
| <td> |
| <div><code><a href="/reference/androidx/collection/SimpleArrayMap.html#getOrDefault(kotlin.Any,kotlin.Any)">getOrDefault</a>(<a href="https://developer.android.com/reference/java/lang/Object.html">Object</a> key, @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> V defaultValue)</code></div> |
| <p>Retrieve a value from the array, or <code><a href="/reference/androidx/collection/SimpleArrayMap.html#getOrDefault(kotlin.Any,kotlin.Any)">defaultValue</a></code> if there is no mapping for the key.</p> |
| </td> |
| </tr> |
| <tr> |
| <td><code>int</code></td> |
| <td> |
| <div><code><a href="/reference/androidx/collection/SimpleArrayMap.html#hashCode()">hashCode</a>()</code></div> |
| </td> |
| </tr> |
| <tr> |
| <td><code>int</code></td> |
| <td> |
| <div><code><a href="/reference/androidx/collection/SimpleArrayMap.html#indexOfKey(kotlin.Any)">indexOfKey</a>(@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> K key)</code></div> |
| <p>Returns the index of a key in the set.</p> |
| </td> |
| </tr> |
| <tr> |
| <td><code>boolean</code></td> |
| <td> |
| <div><code><a href="/reference/androidx/collection/SimpleArrayMap.html#isEmpty()">isEmpty</a>()</code></div> |
| <p>Return <code>true</code> if the array map contains no items.</p> |
| </td> |
| </tr> |
| <tr> |
| <td><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> K</code></td> |
| <td> |
| <div><code><a href="/reference/androidx/collection/SimpleArrayMap.html#keyAt(kotlin.Int)">keyAt</a>(int index)</code></div> |
| <p>Return the key at the given index in the array.</p> |
| </td> |
| </tr> |
| <tr> |
| <td><code>V</code></td> |
| <td> |
| <div><code><a href="/reference/androidx/collection/SimpleArrayMap.html#put(kotlin.Any,kotlin.Any)">put</a>(@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> K key, @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> V value)</code></div> |
| <p>Add a new value to the array map.</p> |
| </td> |
| </tr> |
| <tr> |
| <td><code>void</code></td> |
| <td> |
| <div><code><a href="/reference/androidx/collection/SimpleArrayMap.html#putAll(androidx.collection.SimpleArrayMap)">putAll</a>(@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/collection/SimpleArrayMap.html">SimpleArrayMap</a><@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> K, @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> V> map)</code></div> |
| <p>Perform a <code><a href="/reference/androidx/collection/SimpleArrayMap.html#put(kotlin.Any,kotlin.Any)">put</a></code> of all key/value pairs in <code><a href="/reference/androidx/collection/SimpleArrayMap.html#putAll(androidx.collection.SimpleArrayMap)">map</a></code></p> |
| </td> |
| </tr> |
| <tr> |
| <td><code>V</code></td> |
| <td> |
| <div><code><a href="/reference/androidx/collection/SimpleArrayMap.html#putIfAbsent(kotlin.Any,kotlin.Any)">putIfAbsent</a>(@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> K key, @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> V value)</code></div> |
| <p>Add a new value to the array map only if the key does not already have a value or it is mapped to <code>null</code>.</p> |
| </td> |
| </tr> |
| <tr> |
| <td><code>V</code></td> |
| <td> |
| <div><code><a href="/reference/androidx/collection/SimpleArrayMap.html#remove(kotlin.Any)">remove</a>(@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> K key)</code></div> |
| <p>Remove an existing key from the array map.</p> |
| </td> |
| </tr> |
| <tr> |
| <td><code>boolean</code></td> |
| <td> |
| <div><code><a href="/reference/androidx/collection/SimpleArrayMap.html#remove(kotlin.Any,kotlin.Any)">remove</a>(@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> K key, @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> V value)</code></div> |
| <p>Remove an existing key from the array map only if it is currently mapped to <code><a href="/reference/androidx/collection/SimpleArrayMap.html#remove(kotlin.Any,kotlin.Any)">value</a></code>.</p> |
| </td> |
| </tr> |
| <tr> |
| <td><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> V</code></td> |
| <td> |
| <div><code><a href="/reference/androidx/collection/SimpleArrayMap.html#removeAt(kotlin.Int)">removeAt</a>(int index)</code></div> |
| <p>Remove the key/value mapping at the given index.</p> |
| </td> |
| </tr> |
| <tr> |
| <td><code>V</code></td> |
| <td> |
| <div><code><a href="/reference/androidx/collection/SimpleArrayMap.html#replace(kotlin.Any,kotlin.Any)">replace</a>(@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> K key, @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> V value)</code></div> |
| <p>Replace the mapping for <code><a href="/reference/androidx/collection/SimpleArrayMap.html#replace(kotlin.Any,kotlin.Any)">key</a></code> only if it is already mapped to a value.</p> |
| </td> |
| </tr> |
| <tr> |
| <td><code>boolean</code></td> |
| <td> |
| <div><code><a href="/reference/androidx/collection/SimpleArrayMap.html#replace(kotlin.Any,kotlin.Any,kotlin.Any)">replace</a>(@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> K key, @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> V oldValue, @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> V newValue)</code></div> |
| <p>Replace the mapping for <code><a href="/reference/androidx/collection/SimpleArrayMap.html#replace(kotlin.Any,kotlin.Any,kotlin.Any)">key</a></code> only if it is already mapped to <code><a href="/reference/androidx/collection/SimpleArrayMap.html#replace(kotlin.Any,kotlin.Any,kotlin.Any)">oldValue</a></code>.</p> |
| </td> |
| </tr> |
| <tr> |
| <td><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> V</code></td> |
| <td> |
| <div><code><a href="/reference/androidx/collection/SimpleArrayMap.html#setValueAt(kotlin.Int,kotlin.Any)">setValueAt</a>(int index, @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> V value)</code></div> |
| <p>Set the value at a given index in the array.</p> |
| </td> |
| </tr> |
| <tr> |
| <td><code>int</code></td> |
| <td> |
| <div><code><a href="/reference/androidx/collection/SimpleArrayMap.html#size()">size</a>()</code></div> |
| <p>Return the number of items in this array map.</p> |
| </td> |
| </tr> |
| <tr> |
| <td><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/lang/String.html">String</a></code></td> |
| <td> |
| <div><code><a href="/reference/androidx/collection/SimpleArrayMap.html#toString()">toString</a>()</code></div> |
| <p>Returns a string representation of the object.</p> |
| </td> |
| </tr> |
| <tr> |
| <td><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> V</code></td> |
| <td> |
| <div><code><a href="/reference/androidx/collection/SimpleArrayMap.html#valueAt(kotlin.Int)">valueAt</a>(int index)</code></div> |
| <p>Return the value at the given index in the array.</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| <div class="list"> |
| <h2>Public constructors</h2> |
| <div class="api-item"><a name="SimpleArrayMap-kotlin.Int-"></a><a name="simplearraymap"></a> |
| <div class="api-name-block"> |
| <div> |
| <h3 id="SimpleArrayMap(kotlin.Int)">SimpleArrayMap</h3> |
| </div> |
| </div> |
| <pre class="api-signature no-pretty-print">public <K extends <a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>, V extends <a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>> <a href="/reference/androidx/collection/SimpleArrayMap.html#SimpleArrayMap(kotlin.Int)">SimpleArrayMap</a>(int capacity)</pre> |
| <p>Create a new <code><a href="/reference/androidx/collection/SimpleArrayMap.html">SimpleArrayMap</a></code> with a given initial capacity. The default capacity of an array map is 0, and will grow once items are added to it.</p> |
| </div> |
| <div class="api-item"><a name="SimpleArrayMap-androidx.collection.SimpleArrayMap-"></a><a name="simplearraymap"></a> |
| <div class="api-name-block"> |
| <div> |
| <h3 id="SimpleArrayMap(androidx.collection.SimpleArrayMap)">SimpleArrayMap</h3> |
| </div> |
| </div> |
| <pre class="api-signature no-pretty-print">public <K extends <a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>, V extends <a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>> <a href="/reference/androidx/collection/SimpleArrayMap.html#SimpleArrayMap(androidx.collection.SimpleArrayMap)">SimpleArrayMap</a>(<br> <a href="/reference/androidx/collection/SimpleArrayMap.html">SimpleArrayMap</a><@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> K, @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> V> map<br>)</pre> |
| <p>Create a new <code><a href="/reference/androidx/collection/SimpleArrayMap.html">SimpleArrayMap</a></code> with the mappings from the given <code><a href="/reference/androidx/collection/SimpleArrayMap.html#<init>(androidx.collection.SimpleArrayMap)">map</a></code>.</p> |
| </div> |
| </div> |
| <div class="list"> |
| <h2>Public methods</h2> |
| <div class="api-item"><a name="clear--"></a><a name="clear"></a> |
| <div class="api-name-block"> |
| <div> |
| <h3 id="clear()">clear</h3> |
| </div> |
| </div> |
| <pre class="api-signature no-pretty-print">public void <a href="/reference/androidx/collection/SimpleArrayMap.html#clear()">clear</a>()</pre> |
| <p>Make the array map empty. All storage is released.</p> |
| <div class="devsite-table-wrapper"> |
| <table class="responsive"> |
| <colgroup> |
| <col width="40%"> |
| <col> |
| </colgroup> |
| <thead> |
| <tr> |
| <th colspan="100%">Throws</th> |
| </tr> |
| </thead> |
| <tbody class="list"> |
| <tr> |
| <td><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-concurrent-modification-exception/index.html">kotlin.ConcurrentModificationException</a></code></td> |
| <td> |
| <p>if it was detected that this <code><a href="/reference/androidx/collection/SimpleArrayMap.html">SimpleArrayMap</a></code> was written to while this operation was running.</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| </div> |
| <div class="api-item"><a name="containsKey-kotlin.Any-"></a><a name="containskey"></a> |
| <div class="api-name-block"> |
| <div> |
| <h3 id="containsKey(kotlin.Any)">containsKey</h3> |
| </div> |
| </div> |
| <pre class="api-signature no-pretty-print">public boolean <a href="/reference/androidx/collection/SimpleArrayMap.html#containsKey(kotlin.Any)">containsKey</a>(@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> K key)</pre> |
| <p>Check whether a key exists in the array.</p> |
| <div class="devsite-table-wrapper"> |
| <table class="responsive"> |
| <colgroup> |
| <col width="40%"> |
| <col> |
| </colgroup> |
| <thead> |
| <tr> |
| <th colspan="100%">Parameters</th> |
| </tr> |
| </thead> |
| <tbody class="list"> |
| <tr> |
| <td><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> K key</code></td> |
| <td> |
| <p>The key to search for.</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| <div class="devsite-table-wrapper"> |
| <table class="responsive"> |
| <colgroup> |
| <col width="40%"> |
| <col> |
| </colgroup> |
| <thead> |
| <tr> |
| <th colspan="100%">Returns</th> |
| </tr> |
| </thead> |
| <tbody class="list"> |
| <tr> |
| <td><code>boolean</code></td> |
| <td> |
| <p>Returns <code>true</code> if the key exists, else <code>false</code>.</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| </div> |
| <div class="api-item"><a name="containsValue-kotlin.Any-"></a><a name="containsvalue"></a> |
| <div class="api-name-block"> |
| <div> |
| <h3 id="containsValue(kotlin.Any)">containsValue</h3> |
| </div> |
| </div> |
| <pre class="api-signature no-pretty-print">public boolean <a href="/reference/androidx/collection/SimpleArrayMap.html#containsValue(kotlin.Any)">containsValue</a>(@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> V value)</pre> |
| <p>Check whether a value exists in the array. This requires a linear search through the entire array.</p> |
| <div class="devsite-table-wrapper"> |
| <table class="responsive"> |
| <colgroup> |
| <col width="40%"> |
| <col> |
| </colgroup> |
| <thead> |
| <tr> |
| <th colspan="100%">Parameters</th> |
| </tr> |
| </thead> |
| <tbody class="list"> |
| <tr> |
| <td><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> V value</code></td> |
| <td> |
| <p>The value to search for.</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| <div class="devsite-table-wrapper"> |
| <table class="responsive"> |
| <colgroup> |
| <col width="40%"> |
| <col> |
| </colgroup> |
| <thead> |
| <tr> |
| <th colspan="100%">Returns</th> |
| </tr> |
| </thead> |
| <tbody class="list"> |
| <tr> |
| <td><code>boolean</code></td> |
| <td> |
| <p>Returns <code>true</code> if the value exists, else <code>false</code>.</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| </div> |
| <div class="api-item"><a name="ensureCapacity-kotlin.Int-"></a><a name="ensurecapacity"></a> |
| <div class="api-name-block"> |
| <div> |
| <h3 id="ensureCapacity(kotlin.Int)">ensureCapacity</h3> |
| </div> |
| </div> |
| <pre class="api-signature no-pretty-print">public void <a href="/reference/androidx/collection/SimpleArrayMap.html#ensureCapacity(kotlin.Int)">ensureCapacity</a>(int minimumCapacity)</pre> |
| <p>Ensure the array map can hold at least <code><a href="/reference/androidx/collection/SimpleArrayMap.html#ensureCapacity(kotlin.Int)">minimumCapacity</a></code> items.</p> |
| <div class="devsite-table-wrapper"> |
| <table class="responsive"> |
| <colgroup> |
| <col width="40%"> |
| <col> |
| </colgroup> |
| <thead> |
| <tr> |
| <th colspan="100%">Throws</th> |
| </tr> |
| </thead> |
| <tbody class="list"> |
| <tr> |
| <td><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-concurrent-modification-exception/index.html">kotlin.ConcurrentModificationException</a></code></td> |
| <td> |
| <p>if it was detected that this <code><a href="/reference/androidx/collection/SimpleArrayMap.html">SimpleArrayMap</a></code> was written to while this operation was running.</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| </div> |
| <div class="api-item"><a name="equals-kotlin.Any-"></a><a name="equals"></a> |
| <div class="api-name-block"> |
| <div> |
| <h3 id="equals(kotlin.Any)">equals</h3> |
| </div> |
| </div> |
| <pre class="api-signature no-pretty-print">public boolean <a href="/reference/androidx/collection/SimpleArrayMap.html#equals(kotlin.Any)">equals</a>(<a href="https://developer.android.com/reference/java/lang/Object.html">Object</a> other)</pre> |
| <p>This implementation returns <code>false</code> if the object is not a <code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-map/index.html">Map</a></code> or <code><a href="/reference/androidx/collection/SimpleArrayMap.html">SimpleArrayMap</a></code>, or if the maps have different sizes. Otherwise, for each key in this map, values of both maps are compared. If the values for any key are not equal, the method returns false, otherwise it returns <code>true</code>.</p> |
| </div> |
| <div class="api-item"><a name="get-kotlin.Any-"></a><a name="get"></a> |
| <div class="api-name-block"> |
| <div> |
| <h3 id="get(kotlin.Any)">get</h3> |
| </div> |
| </div> |
| <pre class="api-signature no-pretty-print">public V <a href="/reference/androidx/collection/SimpleArrayMap.html#get(kotlin.Any)">get</a>(@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> K key)</pre> |
| <p>Retrieve a value from the array.</p> |
| <div class="devsite-table-wrapper"> |
| <table class="responsive"> |
| <colgroup> |
| <col width="40%"> |
| <col> |
| </colgroup> |
| <thead> |
| <tr> |
| <th colspan="100%">Parameters</th> |
| </tr> |
| </thead> |
| <tbody class="list"> |
| <tr> |
| <td><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> K key</code></td> |
| <td> |
| <p>The key of the value to retrieve.</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| <div class="devsite-table-wrapper"> |
| <table class="responsive"> |
| <colgroup> |
| <col width="40%"> |
| <col> |
| </colgroup> |
| <thead> |
| <tr> |
| <th colspan="100%">Returns</th> |
| </tr> |
| </thead> |
| <tbody class="list"> |
| <tr> |
| <td><code>V</code></td> |
| <td> |
| <p>Returns the value associated with the given key, or <code>null</code> if there is no such key.</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| </div> |
| <div class="api-item"><a name="getOrDefault(kotlin.Any, kotlin.Any)"></a><a name="getOrDefault-kotlin.Any-kotlin.Any-"></a><a name="getordefault"></a> |
| <div class="api-name-block"> |
| <div> |
| <h3 id="getOrDefault(kotlin.Any,kotlin.Any)">getOrDefault</h3> |
| </div> |
| </div> |
| <pre class="api-signature no-pretty-print">public @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> V <a href="/reference/androidx/collection/SimpleArrayMap.html#getOrDefault(kotlin.Any,kotlin.Any)">getOrDefault</a>(<a href="https://developer.android.com/reference/java/lang/Object.html">Object</a> key, @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> V defaultValue)</pre> |
| <p>Retrieve a value from the array, or <code><a href="/reference/androidx/collection/SimpleArrayMap.html#getOrDefault(kotlin.Any,kotlin.Any)">defaultValue</a></code> if there is no mapping for the key.</p> |
| <div class="devsite-table-wrapper"> |
| <table class="responsive"> |
| <colgroup> |
| <col width="40%"> |
| <col> |
| </colgroup> |
| <thead> |
| <tr> |
| <th colspan="100%">Parameters</th> |
| </tr> |
| </thead> |
| <tbody class="list"> |
| <tr> |
| <td><code><a href="https://developer.android.com/reference/java/lang/Object.html">Object</a> key</code></td> |
| <td> |
| <p>The key of the value to retrieve.</p> |
| </td> |
| </tr> |
| <tr> |
| <td><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> V defaultValue</code></td> |
| <td> |
| <p>The default mapping of the key</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| <div class="devsite-table-wrapper"> |
| <table class="responsive"> |
| <colgroup> |
| <col width="40%"> |
| <col> |
| </colgroup> |
| <thead> |
| <tr> |
| <th colspan="100%">Returns</th> |
| </tr> |
| </thead> |
| <tbody class="list"> |
| <tr> |
| <td><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> V</code></td> |
| <td> |
| <p>Returns the value associated with the given key, or <code><a href="/reference/androidx/collection/SimpleArrayMap.html#getOrDefault(kotlin.Any,kotlin.Any)">defaultValue</a></code> if there is no mapping for the key.</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| </div> |
| <div class="api-item"><a name="hashCode--"></a><a name="hashcode"></a> |
| <div class="api-name-block"> |
| <div> |
| <h3 id="hashCode()">hashCode</h3> |
| </div> |
| </div> |
| <pre class="api-signature no-pretty-print">public int <a href="/reference/androidx/collection/SimpleArrayMap.html#hashCode()">hashCode</a>()</pre> |
| </div> |
| <div class="api-item"><a name="indexOfKey-kotlin.Any-"></a><a name="indexofkey"></a> |
| <div class="api-name-block"> |
| <div> |
| <h3 id="indexOfKey(kotlin.Any)">indexOfKey</h3> |
| </div> |
| </div> |
| <pre class="api-signature no-pretty-print">public int <a href="/reference/androidx/collection/SimpleArrayMap.html#indexOfKey(kotlin.Any)">indexOfKey</a>(@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> K key)</pre> |
| <p>Returns the index of a key in the set.</p> |
| <div class="devsite-table-wrapper"> |
| <table class="responsive"> |
| <colgroup> |
| <col width="40%"> |
| <col> |
| </colgroup> |
| <thead> |
| <tr> |
| <th colspan="100%">Parameters</th> |
| </tr> |
| </thead> |
| <tbody class="list"> |
| <tr> |
| <td><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> K key</code></td> |
| <td> |
| <p>The key to search for.</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| <div class="devsite-table-wrapper"> |
| <table class="responsive"> |
| <colgroup> |
| <col width="40%"> |
| <col> |
| </colgroup> |
| <thead> |
| <tr> |
| <th colspan="100%">Returns</th> |
| </tr> |
| </thead> |
| <tbody class="list"> |
| <tr> |
| <td><code>int</code></td> |
| <td> |
| <p>Returns the index of the key if it exists, else a negative integer.</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| </div> |
| <div class="api-item"><a name="isEmpty--"></a><a name="isempty"></a> |
| <div class="api-name-block"> |
| <div> |
| <h3 id="isEmpty()">isEmpty</h3> |
| </div> |
| </div> |
| <pre class="api-signature no-pretty-print">public boolean <a href="/reference/androidx/collection/SimpleArrayMap.html#isEmpty()">isEmpty</a>()</pre> |
| <p>Return <code>true</code> if the array map contains no items.</p> |
| </div> |
| <div class="api-item"><a name="keyAt-kotlin.Int-"></a><a name="keyat"></a> |
| <div class="api-name-block"> |
| <div> |
| <h3 id="keyAt(kotlin.Int)">keyAt</h3> |
| </div> |
| </div> |
| <pre class="api-signature no-pretty-print">public @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> K <a href="/reference/androidx/collection/SimpleArrayMap.html#keyAt(kotlin.Int)">keyAt</a>(int index)</pre> |
| <p>Return the key at the given index in the array.</p> |
| <div class="devsite-table-wrapper"> |
| <table class="responsive"> |
| <colgroup> |
| <col width="40%"> |
| <col> |
| </colgroup> |
| <thead> |
| <tr> |
| <th colspan="100%">Parameters</th> |
| </tr> |
| </thead> |
| <tbody class="list"> |
| <tr> |
| <td><code>int index</code></td> |
| <td> |
| <p>The desired index, must be between 0 and <code><a href="/reference/androidx/collection/SimpleArrayMap.html#size()">size</a></code>-1 (inclusive).</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| <div class="devsite-table-wrapper"> |
| <table class="responsive"> |
| <colgroup> |
| <col width="40%"> |
| <col> |
| </colgroup> |
| <thead> |
| <tr> |
| <th colspan="100%">Returns</th> |
| </tr> |
| </thead> |
| <tbody class="list"> |
| <tr> |
| <td><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> K</code></td> |
| <td> |
| <p>Returns the key stored at the given index.</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| <div class="devsite-table-wrapper"> |
| <table class="responsive"> |
| <colgroup> |
| <col width="40%"> |
| <col> |
| </colgroup> |
| <thead> |
| <tr> |
| <th colspan="100%">Throws</th> |
| </tr> |
| </thead> |
| <tbody class="list"> |
| <tr> |
| <td><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-illegal-argument-exception/index.html">kotlin.IllegalArgumentException</a></code></td> |
| <td> |
| <p>if <code><a href="/reference/androidx/collection/SimpleArrayMap.html#keyAt(kotlin.Int)">index</a></code> is not between 0 and <code><a href="/reference/androidx/collection/SimpleArrayMap.html#size()">size</a></code>-1</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| </div> |
| <div class="api-item"><a name="put(kotlin.Any, kotlin.Any)"></a><a name="put-kotlin.Any-kotlin.Any-"></a><a name="put"></a> |
| <div class="api-name-block"> |
| <div> |
| <h3 id="put(kotlin.Any,kotlin.Any)">put</h3> |
| </div> |
| </div> |
| <pre class="api-signature no-pretty-print">public V <a href="/reference/androidx/collection/SimpleArrayMap.html#put(kotlin.Any,kotlin.Any)">put</a>(@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> K key, @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> V value)</pre> |
| <p>Add a new value to the array map.</p> |
| <div class="devsite-table-wrapper"> |
| <table class="responsive"> |
| <colgroup> |
| <col width="40%"> |
| <col> |
| </colgroup> |
| <thead> |
| <tr> |
| <th colspan="100%">Parameters</th> |
| </tr> |
| </thead> |
| <tbody class="list"> |
| <tr> |
| <td><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> K key</code></td> |
| <td> |
| <p>The key under which to store the value. If this key already exists in the array, its value will be replaced.</p> |
| </td> |
| </tr> |
| <tr> |
| <td><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> V value</code></td> |
| <td> |
| <p>The value to store for the given key.</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| <div class="devsite-table-wrapper"> |
| <table class="responsive"> |
| <colgroup> |
| <col width="40%"> |
| <col> |
| </colgroup> |
| <thead> |
| <tr> |
| <th colspan="100%">Returns</th> |
| </tr> |
| </thead> |
| <tbody class="list"> |
| <tr> |
| <td><code>V</code></td> |
| <td> |
| <p>Returns the old value that was stored for the given key, or <code>null</code> if there was no such key.</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| <div class="devsite-table-wrapper"> |
| <table class="responsive"> |
| <colgroup> |
| <col width="40%"> |
| <col> |
| </colgroup> |
| <thead> |
| <tr> |
| <th colspan="100%">Throws</th> |
| </tr> |
| </thead> |
| <tbody class="list"> |
| <tr> |
| <td><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-concurrent-modification-exception/index.html">kotlin.ConcurrentModificationException</a></code></td> |
| <td> |
| <p>if it was detected that this <code><a href="/reference/androidx/collection/SimpleArrayMap.html">SimpleArrayMap</a></code> was written to while this operation was running.</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| </div> |
| <div class="api-item"><a name="putAll-androidx.collection.SimpleArrayMap-"></a><a name="putall"></a> |
| <div class="api-name-block"> |
| <div> |
| <h3 id="putAll(androidx.collection.SimpleArrayMap)">putAll</h3> |
| </div> |
| </div> |
| <pre class="api-signature no-pretty-print">public void <a href="/reference/androidx/collection/SimpleArrayMap.html#putAll(androidx.collection.SimpleArrayMap)">putAll</a>(@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/collection/SimpleArrayMap.html">SimpleArrayMap</a><@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> K, @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> V> map)</pre> |
| <p>Perform a <code><a href="/reference/androidx/collection/SimpleArrayMap.html#put(kotlin.Any,kotlin.Any)">put</a></code> of all key/value pairs in <code><a href="/reference/androidx/collection/SimpleArrayMap.html#putAll(androidx.collection.SimpleArrayMap)">map</a></code></p> |
| <div class="devsite-table-wrapper"> |
| <table class="responsive"> |
| <colgroup> |
| <col width="40%"> |
| <col> |
| </colgroup> |
| <thead> |
| <tr> |
| <th colspan="100%">Parameters</th> |
| </tr> |
| </thead> |
| <tbody class="list"> |
| <tr> |
| <td><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/collection/SimpleArrayMap.html">SimpleArrayMap</a><@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> K, @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> V> map</code></td> |
| <td> |
| <p>The array whose contents are to be retrieved.</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| </div> |
| <div class="api-item"><a name="putIfAbsent(kotlin.Any, kotlin.Any)"></a><a name="putIfAbsent-kotlin.Any-kotlin.Any-"></a><a name="putifabsent"></a> |
| <div class="api-name-block"> |
| <div> |
| <h3 id="putIfAbsent(kotlin.Any,kotlin.Any)">putIfAbsent</h3> |
| </div> |
| </div> |
| <pre class="api-signature no-pretty-print">public V <a href="/reference/androidx/collection/SimpleArrayMap.html#putIfAbsent(kotlin.Any,kotlin.Any)">putIfAbsent</a>(@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> K key, @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> V value)</pre> |
| <p>Add a new value to the array map only if the key does not already have a value or it is mapped to <code>null</code>.</p> |
| <div class="devsite-table-wrapper"> |
| <table class="responsive"> |
| <colgroup> |
| <col width="40%"> |
| <col> |
| </colgroup> |
| <thead> |
| <tr> |
| <th colspan="100%">Parameters</th> |
| </tr> |
| </thead> |
| <tbody class="list"> |
| <tr> |
| <td><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> K key</code></td> |
| <td> |
| <p>The key under which to store the value.</p> |
| </td> |
| </tr> |
| <tr> |
| <td><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> V value</code></td> |
| <td> |
| <p>The value to store for the given key.</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| <div class="devsite-table-wrapper"> |
| <table class="responsive"> |
| <colgroup> |
| <col width="40%"> |
| <col> |
| </colgroup> |
| <thead> |
| <tr> |
| <th colspan="100%">Returns</th> |
| </tr> |
| </thead> |
| <tbody class="list"> |
| <tr> |
| <td><code>V</code></td> |
| <td> |
| <p>Returns the value that was stored for the given key, or <code>null</code> if there was no such key.</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| </div> |
| <div class="api-item"><a name="remove-kotlin.Any-"></a><a name="remove"></a> |
| <div class="api-name-block"> |
| <div> |
| <h3 id="remove(kotlin.Any)">remove</h3> |
| </div> |
| </div> |
| <pre class="api-signature no-pretty-print">public V <a href="/reference/androidx/collection/SimpleArrayMap.html#remove(kotlin.Any)">remove</a>(@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> K key)</pre> |
| <p>Remove an existing key from the array map.</p> |
| <div class="devsite-table-wrapper"> |
| <table class="responsive"> |
| <colgroup> |
| <col width="40%"> |
| <col> |
| </colgroup> |
| <thead> |
| <tr> |
| <th colspan="100%">Parameters</th> |
| </tr> |
| </thead> |
| <tbody class="list"> |
| <tr> |
| <td><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> K key</code></td> |
| <td> |
| <p>The key of the mapping to remove.</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| <div class="devsite-table-wrapper"> |
| <table class="responsive"> |
| <colgroup> |
| <col width="40%"> |
| <col> |
| </colgroup> |
| <thead> |
| <tr> |
| <th colspan="100%">Returns</th> |
| </tr> |
| </thead> |
| <tbody class="list"> |
| <tr> |
| <td><code>V</code></td> |
| <td> |
| <p>Returns the value that was stored under the key, or <code>null</code> if there was no such key.</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| </div> |
| <div class="api-item"><a name="remove(kotlin.Any, kotlin.Any)"></a><a name="remove-kotlin.Any-kotlin.Any-"></a><a name="remove"></a> |
| <div class="api-name-block"> |
| <div> |
| <h3 id="remove(kotlin.Any,kotlin.Any)">remove</h3> |
| </div> |
| </div> |
| <pre class="api-signature no-pretty-print">public boolean <a href="/reference/androidx/collection/SimpleArrayMap.html#remove(kotlin.Any,kotlin.Any)">remove</a>(@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> K key, @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> V value)</pre> |
| <p>Remove an existing key from the array map only if it is currently mapped to <code><a href="/reference/androidx/collection/SimpleArrayMap.html#remove(kotlin.Any,kotlin.Any)">value</a></code>.</p> |
| <div class="devsite-table-wrapper"> |
| <table class="responsive"> |
| <colgroup> |
| <col width="40%"> |
| <col> |
| </colgroup> |
| <thead> |
| <tr> |
| <th colspan="100%">Parameters</th> |
| </tr> |
| </thead> |
| <tbody class="list"> |
| <tr> |
| <td><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> K key</code></td> |
| <td> |
| <p>The key of the mapping to remove.</p> |
| </td> |
| </tr> |
| <tr> |
| <td><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> V value</code></td> |
| <td> |
| <p>The value expected to be mapped to the key.</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| <div class="devsite-table-wrapper"> |
| <table class="responsive"> |
| <colgroup> |
| <col width="40%"> |
| <col> |
| </colgroup> |
| <thead> |
| <tr> |
| <th colspan="100%">Returns</th> |
| </tr> |
| </thead> |
| <tbody class="list"> |
| <tr> |
| <td><code>boolean</code></td> |
| <td> |
| <p>Returns <code>true</code> if the mapping was removed.</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| </div> |
| <div class="api-item"><a name="removeAt-kotlin.Int-"></a><a name="removeat"></a> |
| <div class="api-name-block"> |
| <div> |
| <h3 id="removeAt(kotlin.Int)">removeAt</h3> |
| </div> |
| </div> |
| <pre class="api-signature no-pretty-print">public @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> V <a href="/reference/androidx/collection/SimpleArrayMap.html#removeAt(kotlin.Int)">removeAt</a>(int index)</pre> |
| <p>Remove the key/value mapping at the given index.</p> |
| <div class="devsite-table-wrapper"> |
| <table class="responsive"> |
| <colgroup> |
| <col width="40%"> |
| <col> |
| </colgroup> |
| <thead> |
| <tr> |
| <th colspan="100%">Parameters</th> |
| </tr> |
| </thead> |
| <tbody class="list"> |
| <tr> |
| <td><code>int index</code></td> |
| <td> |
| <p>The desired index, must be between 0 and <code><a href="/reference/androidx/collection/SimpleArrayMap.html#size()">size</a></code>-1 (inclusive).</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| <div class="devsite-table-wrapper"> |
| <table class="responsive"> |
| <colgroup> |
| <col width="40%"> |
| <col> |
| </colgroup> |
| <thead> |
| <tr> |
| <th colspan="100%">Returns</th> |
| </tr> |
| </thead> |
| <tbody class="list"> |
| <tr> |
| <td><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> V</code></td> |
| <td> |
| <p>Returns the value that was stored at this index.</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| <div class="devsite-table-wrapper"> |
| <table class="responsive"> |
| <colgroup> |
| <col width="40%"> |
| <col> |
| </colgroup> |
| <thead> |
| <tr> |
| <th colspan="100%">Throws</th> |
| </tr> |
| </thead> |
| <tbody class="list"> |
| <tr> |
| <td><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-concurrent-modification-exception/index.html">kotlin.ConcurrentModificationException</a></code></td> |
| <td> |
| <p>if it was detected that this <code><a href="/reference/androidx/collection/SimpleArrayMap.html">SimpleArrayMap</a></code> was written to while this operation was running.</p> |
| </td> |
| </tr> |
| <tr> |
| <td><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-illegal-argument-exception/index.html">kotlin.IllegalArgumentException</a></code></td> |
| <td> |
| <p>if <code><a href="/reference/androidx/collection/SimpleArrayMap.html#removeAt(kotlin.Int)">index</a></code> is not between 0 and <code><a href="/reference/androidx/collection/SimpleArrayMap.html#size()">size</a></code>-1</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| </div> |
| <div class="api-item"><a name="replace(kotlin.Any, kotlin.Any)"></a><a name="replace-kotlin.Any-kotlin.Any-"></a><a name="replace"></a> |
| <div class="api-name-block"> |
| <div> |
| <h3 id="replace(kotlin.Any,kotlin.Any)">replace</h3> |
| </div> |
| </div> |
| <pre class="api-signature no-pretty-print">public V <a href="/reference/androidx/collection/SimpleArrayMap.html#replace(kotlin.Any,kotlin.Any)">replace</a>(@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> K key, @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> V value)</pre> |
| <p>Replace the mapping for <code><a href="/reference/androidx/collection/SimpleArrayMap.html#replace(kotlin.Any,kotlin.Any)">key</a></code> only if it is already mapped to a value.</p> |
| <div class="devsite-table-wrapper"> |
| <table class="responsive"> |
| <colgroup> |
| <col width="40%"> |
| <col> |
| </colgroup> |
| <thead> |
| <tr> |
| <th colspan="100%">Parameters</th> |
| </tr> |
| </thead> |
| <tbody class="list"> |
| <tr> |
| <td><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> K key</code></td> |
| <td> |
| <p>The key of the mapping to replace.</p> |
| </td> |
| </tr> |
| <tr> |
| <td><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> V value</code></td> |
| <td> |
| <p>The value to store for the given key.</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| <div class="devsite-table-wrapper"> |
| <table class="responsive"> |
| <colgroup> |
| <col width="40%"> |
| <col> |
| </colgroup> |
| <thead> |
| <tr> |
| <th colspan="100%">Returns</th> |
| </tr> |
| </thead> |
| <tbody class="list"> |
| <tr> |
| <td><code>V</code></td> |
| <td> |
| <p>Returns the previous mapped value or <code>null</code>.</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| </div> |
| <div class="api-item"><a name="replace(kotlin.Any, kotlin.Any, kotlin.Any)"></a><a name="replace-kotlin.Any-kotlin.Any-kotlin.Any-"></a><a name="replace"></a> |
| <div class="api-name-block"> |
| <div> |
| <h3 id="replace(kotlin.Any,kotlin.Any,kotlin.Any)">replace</h3> |
| </div> |
| </div> |
| <pre class="api-signature no-pretty-print">public boolean <a href="/reference/androidx/collection/SimpleArrayMap.html#replace(kotlin.Any,kotlin.Any,kotlin.Any)">replace</a>(@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> K key, @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> V oldValue, @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> V newValue)</pre> |
| <p>Replace the mapping for <code><a href="/reference/androidx/collection/SimpleArrayMap.html#replace(kotlin.Any,kotlin.Any,kotlin.Any)">key</a></code> only if it is already mapped to <code><a href="/reference/androidx/collection/SimpleArrayMap.html#replace(kotlin.Any,kotlin.Any,kotlin.Any)">oldValue</a></code>.</p> |
| <div class="devsite-table-wrapper"> |
| <table class="responsive"> |
| <colgroup> |
| <col width="40%"> |
| <col> |
| </colgroup> |
| <thead> |
| <tr> |
| <th colspan="100%">Parameters</th> |
| </tr> |
| </thead> |
| <tbody class="list"> |
| <tr> |
| <td><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> K key</code></td> |
| <td> |
| <p>The key of the mapping to replace.</p> |
| </td> |
| </tr> |
| <tr> |
| <td><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> V oldValue</code></td> |
| <td> |
| <p>The value expected to be mapped to the key.</p> |
| </td> |
| </tr> |
| <tr> |
| <td><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> V newValue</code></td> |
| <td> |
| <p>The value to store for the given key.</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| <div class="devsite-table-wrapper"> |
| <table class="responsive"> |
| <colgroup> |
| <col width="40%"> |
| <col> |
| </colgroup> |
| <thead> |
| <tr> |
| <th colspan="100%">Returns</th> |
| </tr> |
| </thead> |
| <tbody class="list"> |
| <tr> |
| <td><code>boolean</code></td> |
| <td> |
| <p>Returns <code>true</code> if the value was replaced.</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| </div> |
| <div class="api-item"><a name="setValueAt(kotlin.Int, kotlin.Any)"></a><a name="setValueAt-kotlin.Int-kotlin.Any-"></a><a name="setvalueat"></a> |
| <div class="api-name-block"> |
| <div> |
| <h3 id="setValueAt(kotlin.Int,kotlin.Any)">setValueAt</h3> |
| </div> |
| </div> |
| <pre class="api-signature no-pretty-print">public @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> V <a href="/reference/androidx/collection/SimpleArrayMap.html#setValueAt(kotlin.Int,kotlin.Any)">setValueAt</a>(int index, @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> V value)</pre> |
| <p>Set the value at a given index in the array.</p> |
| <div class="devsite-table-wrapper"> |
| <table class="responsive"> |
| <colgroup> |
| <col width="40%"> |
| <col> |
| </colgroup> |
| <thead> |
| <tr> |
| <th colspan="100%">Parameters</th> |
| </tr> |
| </thead> |
| <tbody class="list"> |
| <tr> |
| <td><code>int index</code></td> |
| <td> |
| <p>The desired index, must be between 0 and <code><a href="/reference/androidx/collection/SimpleArrayMap.html#size()">size</a></code>-1 (inclusive).</p> |
| </td> |
| </tr> |
| <tr> |
| <td><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> V value</code></td> |
| <td> |
| <p>The new value to store at this index.</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| <div class="devsite-table-wrapper"> |
| <table class="responsive"> |
| <colgroup> |
| <col width="40%"> |
| <col> |
| </colgroup> |
| <thead> |
| <tr> |
| <th colspan="100%">Returns</th> |
| </tr> |
| </thead> |
| <tbody class="list"> |
| <tr> |
| <td><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> V</code></td> |
| <td> |
| <p>Returns the previous value at the given index.</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| <div class="devsite-table-wrapper"> |
| <table class="responsive"> |
| <colgroup> |
| <col width="40%"> |
| <col> |
| </colgroup> |
| <thead> |
| <tr> |
| <th colspan="100%">Throws</th> |
| </tr> |
| </thead> |
| <tbody class="list"> |
| <tr> |
| <td><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-illegal-argument-exception/index.html">kotlin.IllegalArgumentException</a></code></td> |
| <td> |
| <p>if <code><a href="/reference/androidx/collection/SimpleArrayMap.html#setValueAt(kotlin.Int,kotlin.Any)">index</a></code> is not between 0 and <code><a href="/reference/androidx/collection/SimpleArrayMap.html#size()">size</a></code>-1</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| </div> |
| <div class="api-item"><a name="size--"></a><a name="size"></a> |
| <div class="api-name-block"> |
| <div> |
| <h3 id="size()">size</h3> |
| </div> |
| </div> |
| <pre class="api-signature no-pretty-print">public int <a href="/reference/androidx/collection/SimpleArrayMap.html#size()">size</a>()</pre> |
| <p>Return the number of items in this array map.</p> |
| </div> |
| <div class="api-item"><a name="toString--"></a><a name="tostring"></a> |
| <div class="api-name-block"> |
| <div> |
| <h3 id="toString()">toString</h3> |
| </div> |
| </div> |
| <pre class="api-signature no-pretty-print">public @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/lang/String.html">String</a> <a href="/reference/androidx/collection/SimpleArrayMap.html#toString()">toString</a>()</pre> |
| <p>Returns a string representation of the object.</p> |
| <p>This implementation composes a string by iterating over its mappings. If this map contains itself as a key or a value, the string "(this Map)" will appear in its place.</p> |
| </div> |
| <div class="api-item"><a name="valueAt-kotlin.Int-"></a><a name="valueat"></a> |
| <div class="api-name-block"> |
| <div> |
| <h3 id="valueAt(kotlin.Int)">valueAt</h3> |
| </div> |
| </div> |
| <pre class="api-signature no-pretty-print">public @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> V <a href="/reference/androidx/collection/SimpleArrayMap.html#valueAt(kotlin.Int)">valueAt</a>(int index)</pre> |
| <p>Return the value at the given index in the array.</p> |
| <div class="devsite-table-wrapper"> |
| <table class="responsive"> |
| <colgroup> |
| <col width="40%"> |
| <col> |
| </colgroup> |
| <thead> |
| <tr> |
| <th colspan="100%">Parameters</th> |
| </tr> |
| </thead> |
| <tbody class="list"> |
| <tr> |
| <td><code>int index</code></td> |
| <td> |
| <p>The desired index, must be between 0 and <code><a href="/reference/androidx/collection/SimpleArrayMap.html#size()">size</a></code>-1 (inclusive).</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| <div class="devsite-table-wrapper"> |
| <table class="responsive"> |
| <colgroup> |
| <col width="40%"> |
| <col> |
| </colgroup> |
| <thead> |
| <tr> |
| <th colspan="100%">Returns</th> |
| </tr> |
| </thead> |
| <tbody class="list"> |
| <tr> |
| <td><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> V</code></td> |
| <td> |
| <p>Returns the value stored at the given index.</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| <div class="devsite-table-wrapper"> |
| <table class="responsive"> |
| <colgroup> |
| <col width="40%"> |
| <col> |
| </colgroup> |
| <thead> |
| <tr> |
| <th colspan="100%">Throws</th> |
| </tr> |
| </thead> |
| <tbody class="list"> |
| <tr> |
| <td><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-illegal-argument-exception/index.html">kotlin.IllegalArgumentException</a></code></td> |
| <td> |
| <p>if <code><a href="/reference/androidx/collection/SimpleArrayMap.html#valueAt(kotlin.Int)">index</a></code> is not between 0 and <code><a href="/reference/androidx/collection/SimpleArrayMap.html#size()">size</a></code>-1</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| </div> |
| </div> |
| </body> |
| </html> |