blob: 4c9c38889e212922ca14cd45a340e5ac7cbff926 [file] [log] [blame]
<html devsite="true">
<head>
<title>FooSparseArray</title>
{% setvar book_path %}/reference/kotlin/commonMain/_book.yaml{% endsetvar %}
{% include "_shared/_reference-head-tags.html" %}
</head>
<body>
<div id="metadata-info-block"></div>
<h1>FooSparseArray</h1>
<devsite-select id="platform" label="Select a platform"><select multiple="multiple"><option selected="selected" value="platform-Common/All">Common/All</option></select></devsite-select >
<devsite-filter select-el-container-id="platform">
<div>
<ul class="list" style="list-style: none; padding-left: 0">
<li>
<div class="kotlin-platform" data-title="Common/All">Cmn</div>
<!--platform-Common/All-->
<pre>interface <a href="/reference/kotlin/androidx/collection/FooSparseArray.html">FooSparseArray</a>&lt;E&nbsp;:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html">Any</a>?&gt;</pre>
</li>
</ul>
</div>
</devsite-filter >
<hr>
<p>SparseArray mapping longs to Objects. Unlike a normal array of Objects, there can be gaps in the indices. It is intended to be more memory efficient than using a HashMap to map Longs to Objects, both because it avoids auto-boxing keys and its data structure doesn't rely on an extra entry object for each mapping.</p>
<p>Note that this container keeps its mappings in an array data structure, using a binary search to find keys. The implementation is not intended to be appropriate for data structures that may contain large numbers of items. It is generally slower than a traditional HashMap, since lookups require a binary search and adds and removes require inserting and deleting entries in the array. For containers holding up to hundreds of items, the performance difference is not significant, less than 50%.</p>
<p>To help with performance, the container includes an optimization when removing keys: instead of compacting its array immediately, it leaves the removed entry marked as deleted. The entry can then be re-used for the same key, or compacted later in a single garbage collection step of all removed entries. This garbage collection will need to be performed at any time the array needs to be grown or the map size or entry values are retrieved.</p>
<p>It is possible to iterate over the items in this container using <code><a href="/reference/kotlin/androidx/collection/FooSparseArray.html#keyAt(kotlin.Int)">keyAt</a></code> and <code><a href="/reference/kotlin/androidx/collection/FooSparseArray.html#valueAt(kotlin.Int)">valueAt</a></code>. Iterating over the keys using <code><a href="/reference/kotlin/androidx/collection/FooSparseArray.html#keyAt(kotlin.Int)">keyAt</a></code> with ascending values of the index will return the keys in ascending order, or the values corresponding to the keys in ascending order in the case of <code><a href="/reference/kotlin/androidx/collection/FooSparseArray.html#valueAt(kotlin.Int)">valueAt</a></code>.</p>
<h2>Summary</h2>
<div class="devsite-table-wrapper">
<devsite-filter select-el-container-id="platform">
<table class="fixed">
<colgroup>
<col width="35%">
<col width="58%">
<col>
</colgroup>
<thead>
<tr>
<th colspan="100%"><h3>Public functions</h3></th>
</tr>
</thead>
<tbody class="list">
<tr>
<td><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a></code></td>
<td>
<div><code><a href="/reference/kotlin/androidx/collection/FooSparseArray.html#append(kotlin.Long,kotlin.Any)">append</a>(key:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html">Long</a>,&nbsp;value:&nbsp;E)</code></div>
<p>Puts a key/value pair into the array, optimizing for the case where the key is greater than all existing keys in the array.</p>
</td>
<td>
<div class="kotlin-platform" data-title="Common/All">Cmn</div>
<!--platform-Common/All--></td>
</tr>
<tr>
<td><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a></code></td>
<td>
<div><code><a href="/reference/kotlin/androidx/collection/FooSparseArray.html#clear()">clear</a>()</code></div>
<p>Removes all key-value mappings from this <code><a href="/reference/kotlin/androidx/collection/FooSparseArray.html">FooSparseArray</a></code>.</p>
</td>
<td>
<div class="kotlin-platform" data-title="Common/All">Cmn</div>
<!--platform-Common/All--></td>
</tr>
<tr>
<td><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html">Boolean</a></code></td>
<td>
<div><code><a href="/reference/kotlin/androidx/collection/FooSparseArray.html#containsKey(kotlin.Long)">containsKey</a>(key:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html">Long</a>)</code></div>
<p>Returns <code>true</code> if the specified <code><a href="/reference/kotlin/androidx/collection/FooSparseArray.html#containsKey(kotlin.Long)">key</a></code> is mapped.</p>
</td>
<td>
<div class="kotlin-platform" data-title="Common/All">Cmn</div>
<!--platform-Common/All--></td>
</tr>
<tr>
<td><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html">Boolean</a></code></td>
<td>
<div><code><a href="/reference/kotlin/androidx/collection/FooSparseArray.html#containsValue(kotlin.Any)">containsValue</a>(value:&nbsp;E)</code></div>
<p>Returns <code>true</code> if the specified <code><a href="/reference/kotlin/androidx/collection/FooSparseArray.html#containsValue(kotlin.Any)">value</a></code> is mapped from any key.</p>
</td>
<td>
<div class="kotlin-platform" data-title="Common/All">Cmn</div>
<!--platform-Common/All--></td>
</tr>
<tr>
<td><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a></code></td>
<td>
<div><code><span><del><a href="/reference/kotlin/androidx/collection/FooSparseArray.html#delete(kotlin.Long)">delete</a></del></span>(key:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html">Long</a>)</code></div>
<p><strong>This function is deprecated.</strong> Alias for `remove(key)`.</p>
</td>
<td>
<div class="kotlin-platform" data-title="Common/All">Cmn</div>
<!--platform-Common/All--></td>
</tr>
<tr>
<td><code>operator E?</code></td>
<td>
<div><code><a href="/reference/kotlin/androidx/collection/FooSparseArray.html#get(kotlin.Long)">get</a>(key:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html">Long</a>)</code></div>
<p>Gets the value mapped from the specified <code><a href="/reference/kotlin/androidx/collection/FooSparseArray.html#get(kotlin.Long)">key</a></code>, or <code>null</code> if no such mapping has been made.</p>
</td>
<td>
<div class="kotlin-platform" data-title="Common/All">Cmn</div>
<!--platform-Common/All--></td>
</tr>
<tr>
<td><code>E</code></td>
<td>
<div><code><a href="/reference/kotlin/androidx/collection/FooSparseArray.html#get(kotlin.Long,kotlin.Any)">get</a>(key:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html">Long</a>,&nbsp;defaultValue:&nbsp;E)</code></div>
<p>Gets the value mapped from the specified <code><a href="/reference/kotlin/androidx/collection/FooSparseArray.html#get(kotlin.Long,kotlin.Any)">key</a></code>, or <code><a href="/reference/kotlin/androidx/collection/FooSparseArray.html#get(kotlin.Long,kotlin.Any)">defaultValue</a></code> if no such mapping has been made.</p>
</td>
<td>
<div class="kotlin-platform" data-title="Common/All">Cmn</div>
<!--platform-Common/All--></td>
</tr>
<tr>
<td><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a></code></td>
<td>
<div><code><a href="/reference/kotlin/androidx/collection/FooSparseArray.html#indexOfKey(kotlin.Long)">indexOfKey</a>(key:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html">Long</a>)</code></div>
<p>Returns the index for which <code><a href="/reference/kotlin/androidx/collection/FooSparseArray.html#keyAt(kotlin.Int)">keyAt</a></code> would return the specified key, or a negative number if the specified key is not mapped.</p>
</td>
<td>
<div class="kotlin-platform" data-title="Common/All">Cmn</div>
<!--platform-Common/All--></td>
</tr>
<tr>
<td><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a></code></td>
<td>
<div><code><a href="/reference/kotlin/androidx/collection/FooSparseArray.html#indexOfValue(kotlin.Any)">indexOfValue</a>(value:&nbsp;E)</code></div>
<p>Returns an index for which <code><a href="/reference/kotlin/androidx/collection/FooSparseArray.html#valueAt(kotlin.Int)">valueAt</a></code> would return the specified key, or a negative number if no keys map to the specified <code><a href="/reference/kotlin/androidx/collection/FooSparseArray.html#indexOfValue(kotlin.Any)">value</a></code>.</p>
</td>
<td>
<div class="kotlin-platform" data-title="Common/All">Cmn</div>
<!--platform-Common/All--></td>
</tr>
<tr>
<td><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html">Boolean</a></code></td>
<td>
<div><code><a href="/reference/kotlin/androidx/collection/FooSparseArray.html#isEmpty()">isEmpty</a>()</code></div>
<p>Return <code>true</code> if <code><a href="/reference/kotlin/androidx/collection/FooSparseArray.html#size()">size</a></code> is 0.</p>
</td>
<td>
<div class="kotlin-platform" data-title="Common/All">Cmn</div>
<!--platform-Common/All--></td>
</tr>
<tr>
<td><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html">Long</a></code></td>
<td>
<div><code><a href="/reference/kotlin/androidx/collection/FooSparseArray.html#keyAt(kotlin.Int)">keyAt</a>(index:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a>)</code></div>
<p>Given an index in the range <code>0...size()-1</code>, returns the key from the <code>index</code>th key-value mapping that this <code><a href="/reference/kotlin/androidx/collection/FooSparseArray.html">FooSparseArray</a></code> stores.</p>
</td>
<td>
<div class="kotlin-platform" data-title="Common/All">Cmn</div>
<!--platform-Common/All--></td>
</tr>
<tr>
<td><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a></code></td>
<td>
<div><code><a href="/reference/kotlin/androidx/collection/FooSparseArray.html#put(kotlin.Long,kotlin.Any)">put</a>(key:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html">Long</a>,&nbsp;value:&nbsp;E)</code></div>
<p>Adds a mapping from the specified key to the specified value, replacing the previous mapping from the specified key if there was one.</p>
</td>
<td>
<div class="kotlin-platform" data-title="Common/All">Cmn</div>
<!--platform-Common/All--></td>
</tr>
<tr>
<td><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a></code></td>
<td>
<div><code><a href="/reference/kotlin/androidx/collection/FooSparseArray.html#putAll(androidx.collection.FooSparseArray)">putAll</a>(other:&nbsp;<a href="/reference/kotlin/androidx/collection/FooSparseArray.html">FooSparseArray</a>&lt;E&gt;)</code></div>
<p>Copies all of the mappings from <code><a href="/reference/kotlin/androidx/collection/FooSparseArray.html#putAll(androidx.collection.FooSparseArray)">other</a></code> to this map.</p>
</td>
<td>
<div class="kotlin-platform" data-title="Common/All">Cmn</div>
<!--platform-Common/All--></td>
</tr>
<tr>
<td><code>E?</code></td>
<td>
<div><code><a href="/reference/kotlin/androidx/collection/FooSparseArray.html#putIfAbsent(kotlin.Long,kotlin.Any)">putIfAbsent</a>(key:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html">Long</a>,&nbsp;value:&nbsp;E)</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>
<td>
<div class="kotlin-platform" data-title="Common/All">Cmn</div>
<!--platform-Common/All--></td>
</tr>
<tr>
<td><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a></code></td>
<td>
<div><code><a href="/reference/kotlin/androidx/collection/FooSparseArray.html#remove(kotlin.Long)">remove</a>(key:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html">Long</a>)</code></div>
<p>Removes the mapping from the specified <code><a href="/reference/kotlin/androidx/collection/FooSparseArray.html#remove(kotlin.Long)">key</a></code>, if there was any.</p>
</td>
<td>
<div class="kotlin-platform" data-title="Common/All">Cmn</div>
<!--platform-Common/All--></td>
</tr>
<tr>
<td><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html">Boolean</a></code></td>
<td>
<div><code><a href="/reference/kotlin/androidx/collection/FooSparseArray.html#remove(kotlin.Long,kotlin.Any)">remove</a>(key:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html">Long</a>,&nbsp;value:&nbsp;E)</code></div>
<p>Remove an existing key from the array map only if it is currently mapped to <code><a href="/reference/kotlin/androidx/collection/FooSparseArray.html#remove(kotlin.Long,kotlin.Any)">value</a></code>.</p>
</td>
<td>
<div class="kotlin-platform" data-title="Common/All">Cmn</div>
<!--platform-Common/All--></td>
</tr>
<tr>
<td><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a></code></td>
<td>
<div><code><a href="/reference/kotlin/androidx/collection/FooSparseArray.html#removeAt(kotlin.Int)">removeAt</a>(index:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a>)</code></div>
<p>Removes the mapping at the specified <code><a href="/reference/kotlin/androidx/collection/FooSparseArray.html#removeAt(kotlin.Int)">index</a></code>.</p>
</td>
<td>
<div class="kotlin-platform" data-title="Common/All">Cmn</div>
<!--platform-Common/All--></td>
</tr>
<tr>
<td><code>E?</code></td>
<td>
<div><code><a href="/reference/kotlin/androidx/collection/FooSparseArray.html#replace(kotlin.Long,kotlin.Any)">replace</a>(key:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html">Long</a>,&nbsp;value:&nbsp;E)</code></div>
<p>Replace the mapping for <code><a href="/reference/kotlin/androidx/collection/FooSparseArray.html#replace(kotlin.Long,kotlin.Any)">key</a></code> only if it is already mapped to a value.</p>
</td>
<td>
<div class="kotlin-platform" data-title="Common/All">Cmn</div>
<!--platform-Common/All--></td>
</tr>
<tr>
<td><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html">Boolean</a></code></td>
<td>
<div><code><a href="/reference/kotlin/androidx/collection/FooSparseArray.html#replace(kotlin.Long,kotlin.Any,kotlin.Any)">replace</a>(key:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html">Long</a>,&nbsp;oldValue:&nbsp;E,&nbsp;newValue:&nbsp;E)</code></div>
<p>Replace the mapping for <code><a href="/reference/kotlin/androidx/collection/FooSparseArray.html#replace(kotlin.Long,kotlin.Any,kotlin.Any)">key</a></code> only if it is already mapped to a value.</p>
</td>
<td>
<div class="kotlin-platform" data-title="Common/All">Cmn</div>
<!--platform-Common/All--></td>
</tr>
<tr>
<td><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a></code></td>
<td>
<div><code><a href="/reference/kotlin/androidx/collection/FooSparseArray.html#setValueAt(kotlin.Int,kotlin.Any)">setValueAt</a>(index:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a>,&nbsp;value:&nbsp;E)</code></div>
<p>Given an index in the range <code>0...size()-1</code>, sets a new value for the <code>index</code>th key-value mapping that this <code><a href="/reference/kotlin/androidx/collection/FooSparseArray.html">FooSparseArray</a></code> stores.</p>
</td>
<td>
<div class="kotlin-platform" data-title="Common/All">Cmn</div>
<!--platform-Common/All--></td>
</tr>
<tr>
<td><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a></code></td>
<td>
<div><code><a href="/reference/kotlin/androidx/collection/FooSparseArray.html#size()">size</a>()</code></div>
<p>Returns the number of key-value mappings that this <code><a href="/reference/kotlin/androidx/collection/FooSparseArray.html">FooSparseArray</a></code> currently stores.</p>
</td>
<td>
<div class="kotlin-platform" data-title="Common/All">Cmn</div>
<!--platform-Common/All--></td>
</tr>
<tr>
<td><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html">String</a></code></td>
<td>
<div><code><a href="/reference/kotlin/androidx/collection/FooSparseArray.html#toString()">toString</a>()</code></div>
<p>Returns a string representation of the object.</p>
</td>
<td>
<div class="kotlin-platform" data-title="Common/All">Cmn</div>
<!--platform-Common/All--></td>
</tr>
<tr>
<td><code>E</code></td>
<td>
<div><code><a href="/reference/kotlin/androidx/collection/FooSparseArray.html#valueAt(kotlin.Int)">valueAt</a>(index:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a>)</code></div>
<p>Given an index in the range <code>0...size()-1</code>, returns the value from the <code>index</code>th key-value mapping that this <code><a href="/reference/kotlin/androidx/collection/FooSparseArray.html">FooSparseArray</a></code> stores.</p>
</td>
<td>
<div class="kotlin-platform" data-title="Common/All">Cmn</div>
<!--platform-Common/All--></td>
</tr>
</tbody>
</table>
</devsite-filter >
</div>
<div class="devsite-table-wrapper">
<devsite-filter select-el-container-id="platform">
<table class="fixed">
<colgroup>
<col width="35%">
<col width="58%">
<col>
</colgroup>
<thead>
<tr>
<th colspan="100%"><h3>Public properties</h3></th>
</tr>
</thead>
<tbody class="list">
<tr>
<td><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html">Boolean</a></code></td>
<td>
<div><code><a href="/reference/kotlin/androidx/collection/FooSparseArray.html#garbage()">garbage</a></code></div>
</td>
<td>
<div class="kotlin-platform" data-title="Common/All">Cmn</div>
<!--platform-Common/All--></td>
</tr>
<tr>
<td><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long-array/index.html">LongArray</a></code></td>
<td>
<div><code><a href="/reference/kotlin/androidx/collection/FooSparseArray.html#keys()">keys</a></code></div>
</td>
<td>
<div class="kotlin-platform" data-title="Common/All">Cmn</div>
<!--platform-Common/All--></td>
</tr>
<tr>
<td><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a></code></td>
<td>
<div><code><a href="/reference/kotlin/androidx/collection/FooSparseArray.html#size()">size</a></code></div>
</td>
<td>
<div class="kotlin-platform" data-title="Common/All">Cmn</div>
<!--platform-Common/All--></td>
</tr>
<tr>
<td><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html">Array</a>&lt;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html">Any</a>?&gt;</code></td>
<td>
<div><code><a href="/reference/kotlin/androidx/collection/FooSparseArray.html#values()">values</a></code></div>
</td>
<td>
<div class="kotlin-platform" data-title="Common/All">Cmn</div>
<!--platform-Common/All--></td>
</tr>
</tbody>
</table>
</devsite-filter >
</div>
<div class="devsite-table-wrapper">
<devsite-filter select-el-container-id="platform">
<table class="fixed">
<colgroup>
<col width="35%">
<col width="58%">
<col>
</colgroup>
<thead>
<tr>
<th colspan="100%"><h3>Extension functions</h3></th>
</tr>
</thead>
<tbody class="list">
<tr>
<td><code>inline&nbsp;operator <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html">Boolean</a></code></td>
<td>
<div><code>&lt;T&nbsp;:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html">Any</a>?&gt; <a href="/reference/kotlin/androidx/collection/FooSparseArray.html">FooSparseArray</a>&lt;T&gt;.<a href="/reference/kotlin/androidx/collection/FooSparseArray.html#(androidx.collection.FooSparseArray).contains(kotlin.Long)">contains</a>(key:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html">Long</a>)</code></div>
<p>Returns true if the collection contains <code><a href="/reference/kotlin/androidx/collection/package-summary.html#(androidx.collection.FooSparseArray).contains(kotlin.Long)">key</a></code>.</p>
</td>
<td>
<div class="kotlin-platform" data-title="Common/All">Cmn</div>
<!--platform-Common/All--></td>
</tr>
<tr>
<td><code>inline <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a></code></td>
<td>
<div><code>&lt;T&nbsp;:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html">Any</a>?&gt; <a href="/reference/kotlin/androidx/collection/FooSparseArray.html">FooSparseArray</a>&lt;T&gt;.<a href="/reference/kotlin/androidx/collection/FooSparseArray.html#(androidx.collection.FooSparseArray).forEach(kotlin.Function2)">forEach</a>(action:&nbsp;(key:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html">Long</a>, value) <span style="white-space: nowrap;">-&gt;</span> <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a>)</code></div>
<p>Performs the given <code><a href="/reference/kotlin/androidx/collection/package-summary.html#(androidx.collection.FooSparseArray).forEach(kotlin.Function2)">action</a></code> for each key/value entry.</p>
</td>
<td>
<div class="kotlin-platform" data-title="Common/All">Cmn</div>
<!--platform-Common/All--></td>
</tr>
<tr>
<td><code>inline T</code></td>
<td>
<div><code>&lt;T&nbsp;:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html">Any</a>?&gt; <a href="/reference/kotlin/androidx/collection/FooSparseArray.html">FooSparseArray</a>&lt;T&gt;.<a href="/reference/kotlin/androidx/collection/FooSparseArray.html#(androidx.collection.FooSparseArray).getOrDefault(kotlin.Long,kotlin.Any)">getOrDefault</a>(key:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html">Long</a>,&nbsp;defaultValue:&nbsp;T)</code></div>
<p>Return the value corresponding to <code><a href="/reference/kotlin/androidx/collection/package-summary.html#(androidx.collection.FooSparseArray).getOrDefault(kotlin.Long,kotlin.Any)">key</a></code>, or <code><a href="/reference/kotlin/androidx/collection/package-summary.html#(androidx.collection.FooSparseArray).getOrDefault(kotlin.Long,kotlin.Any)">defaultValue</a></code> when not present.</p>
</td>
<td>
<div class="kotlin-platform" data-title="Common/All">Cmn</div>
<!--platform-Common/All--></td>
</tr>
<tr>
<td><code>inline T</code></td>
<td>
<div><code>&lt;T&nbsp;:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html">Any</a>?&gt; <a href="/reference/kotlin/androidx/collection/FooSparseArray.html">FooSparseArray</a>&lt;T&gt;.<a href="/reference/kotlin/androidx/collection/FooSparseArray.html#(androidx.collection.FooSparseArray).getOrElse(kotlin.Long,kotlin.Function0)">getOrElse</a>(key:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html">Long</a>,&nbsp;defaultValue:&nbsp;() <span style="white-space: nowrap;">-&gt;</span> T)</code></div>
<p>Return the value corresponding to <code><a href="/reference/kotlin/androidx/collection/package-summary.html#(androidx.collection.FooSparseArray).getOrElse(kotlin.Long,kotlin.Function0)">key</a></code>, or from <code><a href="/reference/kotlin/androidx/collection/package-summary.html#(androidx.collection.FooSparseArray).getOrElse(kotlin.Long,kotlin.Function0)">defaultValue</a></code> when not present.</p>
</td>
<td>
<div class="kotlin-platform" data-title="Common/All">Cmn</div>
<!--platform-Common/All--></td>
</tr>
<tr>
<td><code>inline <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html">Boolean</a></code></td>
<td>
<div><code>&lt;T&nbsp;:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html">Any</a>?&gt; <a href="/reference/kotlin/androidx/collection/FooSparseArray.html">FooSparseArray</a>&lt;T&gt;.<a href="/reference/kotlin/androidx/collection/FooSparseArray.html#(androidx.collection.FooSparseArray).isNotEmpty()">isNotEmpty</a>()</code></div>
<p>Return true when the collection contains elements.</p>
</td>
<td>
<div class="kotlin-platform" data-title="Common/All">Cmn</div>
<!--platform-Common/All--></td>
</tr>
<tr>
<td><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-long-iterator/index.html">LongIterator</a></code></td>
<td>
<div><code>&lt;T&nbsp;:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html">Any</a>?&gt; <a href="/reference/kotlin/androidx/collection/FooSparseArray.html">FooSparseArray</a>&lt;T&gt;.<a href="/reference/kotlin/androidx/collection/FooSparseArray.html#(androidx.collection.FooSparseArray).keyIterator()">keyIterator</a>()</code></div>
<p>Return an iterator over the collection's keys.</p>
</td>
<td>
<div class="kotlin-platform" data-title="Common/All">Cmn</div>
<!--platform-Common/All--></td>
</tr>
<tr>
<td><code>inline&nbsp;operator <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a></code></td>
<td>
<div><code>&lt;T&nbsp;:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html">Any</a>?&gt; <a href="/reference/kotlin/androidx/collection/FooSparseArray.html">FooSparseArray</a>&lt;T&gt;.<a href="/reference/kotlin/androidx/collection/FooSparseArray.html#(androidx.collection.FooSparseArray).set(kotlin.Long,kotlin.Any)">set</a>(key:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html">Long</a>,&nbsp;value:&nbsp;T)</code></div>
<p>Allows the use of the index operator for storing values in the collection.</p>
</td>
<td>
<div class="kotlin-platform" data-title="Common/All">Cmn</div>
<!--platform-Common/All--></td>
</tr>
<tr>
<td><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-iterator/index.html">Iterator</a>&lt;T&gt;</code></td>
<td>
<div><code>&lt;T&nbsp;:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html">Any</a>?&gt; <a href="/reference/kotlin/androidx/collection/FooSparseArray.html">FooSparseArray</a>&lt;T&gt;.<a href="/reference/kotlin/androidx/collection/FooSparseArray.html#(androidx.collection.FooSparseArray).valueIterator()">valueIterator</a>()</code></div>
<p>Return an iterator over the collection's values.</p>
</td>
<td>
<div class="kotlin-platform" data-title="Common/All">Cmn</div>
<!--platform-Common/All--></td>
</tr>
</tbody>
</table>
</devsite-filter >
</div>
<div class="devsite-table-wrapper">
<devsite-filter select-el-container-id="platform">
<table class="fixed">
<colgroup>
<col width="35%">
<col width="58%">
<col>
</colgroup>
<thead>
<tr>
<th colspan="100%"><h3>Extension properties</h3></th>
</tr>
</thead>
<tbody class="list">
<tr>
<td><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a></code></td>
<td>
<div><code><a href="/reference/kotlin/androidx/collection/FooSparseArray.html">FooSparseArray</a>&lt;T&gt;.<a href="/reference/kotlin/androidx/collection/FooSparseArray.html#(androidx.collection.FooSparseArray).size()">size</a></code></div>
<p>Returns the number of key/value pairs in the collection.</p>
</td>
<td>
<div class="kotlin-platform" data-title="Common/All">Cmn</div>
<!--platform-Common/All--></td>
</tr>
</tbody>
</table>
</devsite-filter >
</div>
<devsite-filter select-el-container-id="platform">
<div class="list">
<h2>Public functions</h2>
<div class="api-item"><a name="append(kotlin.Long, kotlin.Any)"></a><a name="append-kotlin.Long-kotlin.Any-"></a><a name="append"></a>
<h3 class="api-name" id="append(kotlin.Long,kotlin.Any)">append</h3>
<span class="kotlin-platform" data-title="Common/All">Cmn</span>
<!--platform-Common/All-->
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/collection/FooSparseArray.html#append(kotlin.Long,kotlin.Any)">append</a>(key:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html">Long</a>,&nbsp;value:&nbsp;E):&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a></pre>
<p>Puts a key/value pair into the array, optimizing for the case where the key is greater than all existing keys in the array.</p>
</div>
<div class="api-item"><a name="clear--"></a><a name="clear"></a>
<h3 class="api-name" id="clear()">clear</h3>
<span class="kotlin-platform" data-title="Common/All">Cmn</span>
<!--platform-Common/All-->
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/collection/FooSparseArray.html#clear()">clear</a>():&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a></pre>
<p>Removes all key-value mappings from this <code><a href="/reference/kotlin/androidx/collection/FooSparseArray.html">FooSparseArray</a></code>.</p>
</div>
<div class="api-item"><a name="containsKey-kotlin.Long-"></a><a name="containskey"></a>
<h3 class="api-name" id="containsKey(kotlin.Long)">containsKey</h3>
<span class="kotlin-platform" data-title="Common/All">Cmn</span>
<!--platform-Common/All-->
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/collection/FooSparseArray.html#containsKey(kotlin.Long)">containsKey</a>(key:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html">Long</a>):&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html">Boolean</a></pre>
<p>Returns <code>true</code> if the specified <code><a href="/reference/kotlin/androidx/collection/FooSparseArray.html#containsKey(kotlin.Long)">key</a></code> is mapped.</p>
</div>
<div class="api-item"><a name="containsValue-kotlin.Any-"></a><a name="containsvalue"></a>
<h3 class="api-name" id="containsValue(kotlin.Any)">containsValue</h3>
<span class="kotlin-platform" data-title="Common/All">Cmn</span>
<!--platform-Common/All-->
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/collection/FooSparseArray.html#containsValue(kotlin.Any)">containsValue</a>(value:&nbsp;E):&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html">Boolean</a></pre>
<p>Returns <code>true</code> if the specified <code><a href="/reference/kotlin/androidx/collection/FooSparseArray.html#containsValue(kotlin.Any)">value</a></code> is mapped from any key.</p>
</div>
<div class="api-item"><a name="delete-kotlin.Long-"></a><a name="delete"></a>
<h3 class="api-name" id="delete(kotlin.Long)">delete</h3>
<span class="kotlin-platform" data-title="Common/All">Cmn</span>
<!--platform-Common/All-->
<pre class="api-signature no-pretty-print">fun&nbsp;<span><del><a href="/reference/kotlin/androidx/collection/FooSparseArray.html#delete(kotlin.Long)">delete</a></del></span>(key:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html">Long</a>):&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a></pre>
<aside class="caution"><strong>This function is deprecated.</strong><br>Alias for `remove(key)`.</aside>
<p>Removes the mapping from the specified <code><a href="/reference/kotlin/androidx/collection/FooSparseArray.html#delete(kotlin.Long)">key</a></code>, if there was any.</p>
</div>
<div class="api-item"><a name="get-kotlin.Long-"></a><a name="get"></a>
<h3 class="api-name" id="get(kotlin.Long)">get</h3>
<span class="kotlin-platform" data-title="Common/All">Cmn</span>
<!--platform-Common/All-->
<pre class="api-signature no-pretty-print">operator&nbsp;fun&nbsp;<a href="/reference/kotlin/androidx/collection/FooSparseArray.html#get(kotlin.Long)">get</a>(key:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html">Long</a>):&nbsp;E?</pre>
<p>Gets the value mapped from the specified <code><a href="/reference/kotlin/androidx/collection/FooSparseArray.html#get(kotlin.Long)">key</a></code>, or <code>null</code> if no such mapping has been made.</p>
</div>
<div class="api-item"><a name="get(kotlin.Long, kotlin.Any)"></a><a name="get-kotlin.Long-kotlin.Any-"></a><a name="get"></a>
<h3 class="api-name" id="get(kotlin.Long,kotlin.Any)">get</h3>
<span class="kotlin-platform" data-title="Common/All">Cmn</span>
<!--platform-Common/All-->
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/collection/FooSparseArray.html#get(kotlin.Long,kotlin.Any)">get</a>(key:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html">Long</a>,&nbsp;defaultValue:&nbsp;E):&nbsp;E</pre>
<p>Gets the value mapped from the specified <code><a href="/reference/kotlin/androidx/collection/FooSparseArray.html#get(kotlin.Long,kotlin.Any)">key</a></code>, or <code><a href="/reference/kotlin/androidx/collection/FooSparseArray.html#get(kotlin.Long,kotlin.Any)">defaultValue</a></code> if no such mapping has been made.</p>
</div>
<div class="api-item"><a name="indexOfKey-kotlin.Long-"></a><a name="indexofkey"></a>
<h3 class="api-name" id="indexOfKey(kotlin.Long)">indexOfKey</h3>
<span class="kotlin-platform" data-title="Common/All">Cmn</span>
<!--platform-Common/All-->
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/collection/FooSparseArray.html#indexOfKey(kotlin.Long)">indexOfKey</a>(key:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html">Long</a>):&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a></pre>
<p>Returns the index for which <code><a href="/reference/kotlin/androidx/collection/FooSparseArray.html#keyAt(kotlin.Int)">keyAt</a></code> would return the specified key, or a negative number if the specified key is not mapped.</p>
</div>
<div class="api-item"><a name="indexOfValue-kotlin.Any-"></a><a name="indexofvalue"></a>
<h3 class="api-name" id="indexOfValue(kotlin.Any)">indexOfValue</h3>
<span class="kotlin-platform" data-title="Common/All">Cmn</span>
<!--platform-Common/All-->
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/collection/FooSparseArray.html#indexOfValue(kotlin.Any)">indexOfValue</a>(value:&nbsp;E):&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a></pre>
<p>Returns an index for which <code><a href="/reference/kotlin/androidx/collection/FooSparseArray.html#valueAt(kotlin.Int)">valueAt</a></code> would return the specified key, or a negative number if no keys map to the specified <code><a href="/reference/kotlin/androidx/collection/FooSparseArray.html#indexOfValue(kotlin.Any)">value</a></code>.</p>
<p>Beware that this is a linear search, unlike lookups by key, and that multiple keys can map to the same value and this will find only one of them.</p>
</div>
<div class="api-item"><a name="isEmpty--"></a><a name="isempty"></a>
<h3 class="api-name" id="isEmpty()">isEmpty</h3>
<span class="kotlin-platform" data-title="Common/All">Cmn</span>
<!--platform-Common/All-->
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/collection/FooSparseArray.html#isEmpty()">isEmpty</a>():&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html">Boolean</a></pre>
<p>Return <code>true</code> if <code><a href="/reference/kotlin/androidx/collection/FooSparseArray.html#size()">size</a></code> is 0.</p>
<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="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html">Boolean</a></code></td>
<td>
<p><code>true</code> if <code><a href="/reference/kotlin/androidx/collection/FooSparseArray.html#size()">size</a></code> is 0.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="api-item"><a name="keyAt-kotlin.Int-"></a><a name="keyat"></a>
<h3 class="api-name" id="keyAt(kotlin.Int)">keyAt</h3>
<span class="kotlin-platform" data-title="Common/All">Cmn</span>
<!--platform-Common/All-->
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/collection/FooSparseArray.html#keyAt(kotlin.Int)">keyAt</a>(index:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a>):&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html">Long</a></pre>
<p>Given an index in the range <code>0...size()-1</code>, returns the key from the <code>index</code>th key-value mapping that this <code><a href="/reference/kotlin/androidx/collection/FooSparseArray.html">FooSparseArray</a></code> stores.</p>
<p>The keys corresponding to indices in ascending order are guaranteed to be in ascending order, e.g., <code>keyAt(0)</code> will return the smallest key and <code>keyAt(size()-1)</code> will return the largest key.</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>kotlin.IllegalArgumentException:&nbsp;<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/kotlin/androidx/collection/FooSparseArray.html#keyAt(kotlin.Int)">index</a></code> is not in the range <code>0...size()-1</code></p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="api-item"><a name="put(kotlin.Long, kotlin.Any)"></a><a name="put-kotlin.Long-kotlin.Any-"></a><a name="put"></a>
<h3 class="api-name" id="put(kotlin.Long,kotlin.Any)">put</h3>
<span class="kotlin-platform" data-title="Common/All">Cmn</span>
<!--platform-Common/All-->
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/collection/FooSparseArray.html#put(kotlin.Long,kotlin.Any)">put</a>(key:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html">Long</a>,&nbsp;value:&nbsp;E):&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a></pre>
<p>Adds a mapping from the specified key to the specified value, replacing the previous mapping from the specified key if there was one.</p>
</div>
<div class="api-item"><a name="putAll-androidx.collection.FooSparseArray-"></a><a name="putall"></a>
<h3 class="api-name" id="putAll(androidx.collection.FooSparseArray)">putAll</h3>
<span class="kotlin-platform" data-title="Common/All">Cmn</span>
<!--platform-Common/All-->
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/collection/FooSparseArray.html#putAll(androidx.collection.FooSparseArray)">putAll</a>(other:&nbsp;<a href="/reference/kotlin/androidx/collection/FooSparseArray.html">FooSparseArray</a>&lt;E&gt;):&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a></pre>
<p>Copies all of the mappings from <code><a href="/reference/kotlin/androidx/collection/FooSparseArray.html#putAll(androidx.collection.FooSparseArray)">other</a></code> to this map. The effect of this call is equivalent to that of calling <code><a href="/reference/kotlin/androidx/collection/FooSparseArray.html#put(kotlin.Long,kotlin.Any)">put</a></code> on this map once for each mapping from key to value in <code><a href="/reference/kotlin/androidx/collection/FooSparseArray.html#putAll(androidx.collection.FooSparseArray)">other</a></code>.</p>
</div>
<div class="api-item"><a name="putIfAbsent(kotlin.Long, kotlin.Any)"></a><a name="putIfAbsent-kotlin.Long-kotlin.Any-"></a><a name="putifabsent"></a>
<h3 class="api-name" id="putIfAbsent(kotlin.Long,kotlin.Any)">putIfAbsent</h3>
<span class="kotlin-platform" data-title="Common/All">Cmn</span>
<!--platform-Common/All-->
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/collection/FooSparseArray.html#putIfAbsent(kotlin.Long,kotlin.Any)">putIfAbsent</a>(key:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html">Long</a>,&nbsp;value:&nbsp;E):&nbsp;E?</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>key:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html">Long</a></code></td>
<td>
<p>The key under which to store the value.</p>
</td>
</tr>
<tr>
<td><code>value:&nbsp;E</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>E?</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.Long-"></a><a name="remove"></a>
<h3 class="api-name" id="remove(kotlin.Long)">remove</h3>
<span class="kotlin-platform" data-title="Common/All">Cmn</span>
<!--platform-Common/All-->
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/collection/FooSparseArray.html#remove(kotlin.Long)">remove</a>(key:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html">Long</a>):&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a></pre>
<p>Removes the mapping from the specified <code><a href="/reference/kotlin/androidx/collection/FooSparseArray.html#remove(kotlin.Long)">key</a></code>, if there was any.</p>
</div>
<div class="api-item"><a name="remove(kotlin.Long, kotlin.Any)"></a><a name="remove-kotlin.Long-kotlin.Any-"></a><a name="remove"></a>
<h3 class="api-name" id="remove(kotlin.Long,kotlin.Any)">remove</h3>
<span class="kotlin-platform" data-title="Common/All">Cmn</span>
<!--platform-Common/All-->
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/collection/FooSparseArray.html#remove(kotlin.Long,kotlin.Any)">remove</a>(key:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html">Long</a>,&nbsp;value:&nbsp;E):&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html">Boolean</a></pre>
<p>Remove an existing key from the array map only if it is currently mapped to <code><a href="/reference/kotlin/androidx/collection/FooSparseArray.html#remove(kotlin.Long,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>key:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html">Long</a></code></td>
<td>
<p>The key of the mapping to remove.</p>
</td>
</tr>
<tr>
<td><code>value:&nbsp;E</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><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html">Boolean</a></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>
<h3 class="api-name" id="removeAt(kotlin.Int)">removeAt</h3>
<span class="kotlin-platform" data-title="Common/All">Cmn</span>
<!--platform-Common/All-->
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/collection/FooSparseArray.html#removeAt(kotlin.Int)">removeAt</a>(index:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a>):&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a></pre>
<p>Removes the mapping at the specified <code><a href="/reference/kotlin/androidx/collection/FooSparseArray.html#removeAt(kotlin.Int)">index</a></code>.</p>
</div>
<div class="api-item"><a name="replace(kotlin.Long, kotlin.Any)"></a><a name="replace-kotlin.Long-kotlin.Any-"></a><a name="replace"></a>
<h3 class="api-name" id="replace(kotlin.Long,kotlin.Any)">replace</h3>
<span class="kotlin-platform" data-title="Common/All">Cmn</span>
<!--platform-Common/All-->
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/collection/FooSparseArray.html#replace(kotlin.Long,kotlin.Any)">replace</a>(key:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html">Long</a>,&nbsp;value:&nbsp;E):&nbsp;E?</pre>
<p>Replace the mapping for <code><a href="/reference/kotlin/androidx/collection/FooSparseArray.html#replace(kotlin.Long,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>key:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html">Long</a></code></td>
<td>
<p>The key of the mapping to replace.</p>
</td>
</tr>
<tr>
<td><code>value:&nbsp;E</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>E?</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.Long, kotlin.Any, kotlin.Any)"></a><a name="replace-kotlin.Long-kotlin.Any-kotlin.Any-"></a><a name="replace"></a>
<h3 class="api-name" id="replace(kotlin.Long,kotlin.Any,kotlin.Any)">replace</h3>
<span class="kotlin-platform" data-title="Common/All">Cmn</span>
<!--platform-Common/All-->
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/collection/FooSparseArray.html#replace(kotlin.Long,kotlin.Any,kotlin.Any)">replace</a>(key:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html">Long</a>,&nbsp;oldValue:&nbsp;E,&nbsp;newValue:&nbsp;E):&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html">Boolean</a></pre>
<p>Replace the mapping for <code><a href="/reference/kotlin/androidx/collection/FooSparseArray.html#replace(kotlin.Long,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>key:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html">Long</a></code></td>
<td>
<p>The key of the mapping to replace.</p>
</td>
</tr>
<tr>
<td><code>oldValue:&nbsp;E</code></td>
<td>
<p>The value expected to be mapped to the key.</p>
</td>
</tr>
<tr>
<td><code>newValue:&nbsp;E</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><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html">Boolean</a></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>
<h3 class="api-name" id="setValueAt(kotlin.Int,kotlin.Any)">setValueAt</h3>
<span class="kotlin-platform" data-title="Common/All">Cmn</span>
<!--platform-Common/All-->
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/collection/FooSparseArray.html#setValueAt(kotlin.Int,kotlin.Any)">setValueAt</a>(index:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a>,&nbsp;value:&nbsp;E):&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a></pre>
<p>Given an index in the range <code>0...size()-1</code>, sets a new value for the <code>index</code>th key-value mapping that this <code><a href="/reference/kotlin/androidx/collection/FooSparseArray.html">FooSparseArray</a></code> stores.</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>kotlin.IllegalArgumentException:&nbsp;<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/kotlin/androidx/collection/FooSparseArray.html#setValueAt(kotlin.Int,kotlin.Any)">index</a></code> is not in the range <code>0...size()-1</code></p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="api-item"><a name="size--"></a><a name="size"></a>
<h3 class="api-name" id="size()">size</h3>
<span class="kotlin-platform" data-title="Common/All">Cmn</span>
<!--platform-Common/All-->
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/collection/FooSparseArray.html#size()">size</a>():&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a></pre>
<p>Returns the number of key-value mappings that this <code><a href="/reference/kotlin/androidx/collection/FooSparseArray.html">FooSparseArray</a></code> currently stores.</p>
</div>
<div class="api-item"><a name="toString--"></a><a name="tostring"></a>
<h3 class="api-name" id="toString()">toString</h3>
<span class="kotlin-platform" data-title="Common/All">Cmn</span>
<!--platform-Common/All-->
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/collection/FooSparseArray.html#toString()">toString</a>():&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html">String</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 value, the string &quot;(this Map)&quot; will appear in its place.</p>
</div>
<div class="api-item"><a name="valueAt-kotlin.Int-"></a><a name="valueat"></a>
<h3 class="api-name" id="valueAt(kotlin.Int)">valueAt</h3>
<span class="kotlin-platform" data-title="Common/All">Cmn</span>
<!--platform-Common/All-->
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/collection/FooSparseArray.html#valueAt(kotlin.Int)">valueAt</a>(index:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a>):&nbsp;E</pre>
<p>Given an index in the range <code>0...size()-1</code>, returns the value from the <code>index</code>th key-value mapping that this <code><a href="/reference/kotlin/androidx/collection/FooSparseArray.html">FooSparseArray</a></code> stores.</p>
<p>The values corresponding to indices in ascending order are guaranteed to be associated with keys in ascending order, e.g., <code>valueAt(0)</code> will return the value associated with the smallest key and <code>valueAt(size()-1)</code> will return the value associated with the largest key.</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>kotlin.IllegalArgumentException:&nbsp;<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/kotlin/androidx/collection/FooSparseArray.html#valueAt(kotlin.Int)">index</a></code> is not in the range <code>0...size()-1</code></p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</devsite-filter >
<devsite-filter select-el-container-id="platform">
<div class="list">
<h2>Public properties</h2>
<div class="api-item"><a name="getGarbage()"></a><a name="setGarbage()"></a><a name="getGarbage--"></a><a name="setGarbage--"></a>
<h3 class="api-name" id="garbage()">garbage</h3>
<span class="kotlin-platform" data-title="Common/All">Cmn</span>
<!--platform-Common/All-->
<pre class="api-signature no-pretty-print">var&nbsp;<a href="/reference/kotlin/androidx/collection/FooSparseArray.html#garbage()">garbage</a>:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html">Boolean</a></pre>
</div>
<div class="api-item"><a name="getKeys()"></a><a name="setKeys()"></a><a name="getKeys--"></a><a name="setKeys--"></a>
<h3 class="api-name" id="keys()">keys</h3>
<span class="kotlin-platform" data-title="Common/All">Cmn</span>
<!--platform-Common/All-->
<pre class="api-signature no-pretty-print">var&nbsp;<a href="/reference/kotlin/androidx/collection/FooSparseArray.html#keys()">keys</a>:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long-array/index.html">LongArray</a></pre>
</div>
<div class="api-item"><a name="getSize()"></a><a name="setSize()"></a><a name="getSize--"></a><a name="setSize--"></a>
<h3 class="api-name" id="size()">size</h3>
<span class="kotlin-platform" data-title="Common/All">Cmn</span>
<!--platform-Common/All-->
<pre class="api-signature no-pretty-print">var&nbsp;<a href="/reference/kotlin/androidx/collection/FooSparseArray.html#size()">size</a>:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a></pre>
</div>
<div class="api-item"><a name="getValues()"></a><a name="setValues()"></a><a name="getValues--"></a><a name="setValues--"></a>
<h3 class="api-name" id="values()">values</h3>
<span class="kotlin-platform" data-title="Common/All">Cmn</span>
<!--platform-Common/All-->
<pre class="api-signature no-pretty-print">var&nbsp;<a href="/reference/kotlin/androidx/collection/FooSparseArray.html#values()">values</a>:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html">Array</a>&lt;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html">Any</a>?&gt;</pre>
</div>
</div>
</devsite-filter >
<devsite-filter select-el-container-id="platform">
<div class="list">
<h2>Extension functions</h2>
<div class="api-item"><a name="-androidx.collection.FooSparseArray-.contains-kotlin.Long-"></a><a name="contains"></a>
<h3 class="api-name" id="(androidx.collection.FooSparseArray).contains(kotlin.Long)">contains</h3>
<span class="kotlin-platform" data-title="Common/All">Cmn</span>
<!--platform-Common/All-->
<pre class="api-signature no-pretty-print">inline&nbsp;operator&nbsp;fun&nbsp;&lt;T&nbsp;:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html">Any</a>?&gt; <a href="/reference/kotlin/androidx/collection/FooSparseArray.html">FooSparseArray</a>&lt;T&gt;.<a href="/reference/kotlin/androidx/collection/FooSparseArray.html#(androidx.collection.FooSparseArray).contains(kotlin.Long)">contains</a>(key:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html">Long</a>):&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html">Boolean</a></pre>
<p>Returns true if the collection contains <code><a href="/reference/kotlin/androidx/collection/package-summary.html#(androidx.collection.FooSparseArray).contains(kotlin.Long)">key</a></code>.</p>
</div>
<div class="api-item"><a name="-androidx.collection.FooSparseArray-.forEach-kotlin.Function2-"></a><a name="foreach"></a>
<h3 class="api-name" id="(androidx.collection.FooSparseArray).forEach(kotlin.Function2)">forEach</h3>
<span class="kotlin-platform" data-title="Common/All">Cmn</span>
<!--platform-Common/All-->
<pre class="api-signature no-pretty-print">inline&nbsp;fun&nbsp;&lt;T&nbsp;:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html">Any</a>?&gt; <a href="/reference/kotlin/androidx/collection/FooSparseArray.html">FooSparseArray</a>&lt;T&gt;.<a href="/reference/kotlin/androidx/collection/FooSparseArray.html#(androidx.collection.FooSparseArray).forEach(kotlin.Function2)">forEach</a>(action:&nbsp;(key:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html">Long</a>, value) <span style="white-space: nowrap;">-&gt;</span> <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a>):&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a></pre>
<p>Performs the given <code><a href="/reference/kotlin/androidx/collection/package-summary.html#(androidx.collection.FooSparseArray).forEach(kotlin.Function2)">action</a></code> for each key/value entry.</p>
</div>
<div class="api-item"><a name="(androidx.collection.FooSparseArray).getOrDefault(kotlin.Long, kotlin.Any)"></a><a name="-androidx.collection.FooSparseArray-.getOrDefault-kotlin.Long-kotlin.Any-"></a><a name="getordefault"></a>
<h3 class="api-name" id="(androidx.collection.FooSparseArray).getOrDefault(kotlin.Long,kotlin.Any)">getOrDefault</h3>
<span class="kotlin-platform" data-title="Common/All">Cmn</span>
<!--platform-Common/All-->
<pre class="api-signature no-pretty-print">inline&nbsp;fun&nbsp;&lt;T&nbsp;:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html">Any</a>?&gt; <a href="/reference/kotlin/androidx/collection/FooSparseArray.html">FooSparseArray</a>&lt;T&gt;.<a href="/reference/kotlin/androidx/collection/FooSparseArray.html#(androidx.collection.FooSparseArray).getOrDefault(kotlin.Long,kotlin.Any)">getOrDefault</a>(key:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html">Long</a>,&nbsp;defaultValue:&nbsp;T):&nbsp;T</pre>
<p>Return the value corresponding to <code><a href="/reference/kotlin/androidx/collection/package-summary.html#(androidx.collection.FooSparseArray).getOrDefault(kotlin.Long,kotlin.Any)">key</a></code>, or <code><a href="/reference/kotlin/androidx/collection/package-summary.html#(androidx.collection.FooSparseArray).getOrDefault(kotlin.Long,kotlin.Any)">defaultValue</a></code> when not present.</p>
</div>
<div class="api-item"><a name="(androidx.collection.FooSparseArray).getOrElse(kotlin.Long, kotlin.Function0)"></a><a name="-androidx.collection.FooSparseArray-.getOrElse-kotlin.Long-kotlin.Function0-"></a><a name="getorelse"></a>
<h3 class="api-name" id="(androidx.collection.FooSparseArray).getOrElse(kotlin.Long,kotlin.Function0)">getOrElse</h3>
<span class="kotlin-platform" data-title="Common/All">Cmn</span>
<!--platform-Common/All-->
<pre class="api-signature no-pretty-print">inline&nbsp;fun&nbsp;&lt;T&nbsp;:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html">Any</a>?&gt; <a href="/reference/kotlin/androidx/collection/FooSparseArray.html">FooSparseArray</a>&lt;T&gt;.<a href="/reference/kotlin/androidx/collection/FooSparseArray.html#(androidx.collection.FooSparseArray).getOrElse(kotlin.Long,kotlin.Function0)">getOrElse</a>(key:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html">Long</a>,&nbsp;defaultValue:&nbsp;() <span style="white-space: nowrap;">-&gt;</span> T):&nbsp;T</pre>
<p>Return the value corresponding to <code><a href="/reference/kotlin/androidx/collection/package-summary.html#(androidx.collection.FooSparseArray).getOrElse(kotlin.Long,kotlin.Function0)">key</a></code>, or from <code><a href="/reference/kotlin/androidx/collection/package-summary.html#(androidx.collection.FooSparseArray).getOrElse(kotlin.Long,kotlin.Function0)">defaultValue</a></code> when not present.</p>
</div>
<div class="api-item"><a name="-androidx.collection.FooSparseArray-.isNotEmpty--"></a><a name="isnotempty"></a>
<h3 class="api-name" id="(androidx.collection.FooSparseArray).isNotEmpty()">isNotEmpty</h3>
<span class="kotlin-platform" data-title="Common/All">Cmn</span>
<!--platform-Common/All-->
<pre class="api-signature no-pretty-print">inline&nbsp;fun&nbsp;&lt;T&nbsp;:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html">Any</a>?&gt; <a href="/reference/kotlin/androidx/collection/FooSparseArray.html">FooSparseArray</a>&lt;T&gt;.<a href="/reference/kotlin/androidx/collection/FooSparseArray.html#(androidx.collection.FooSparseArray).isNotEmpty()">isNotEmpty</a>():&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html">Boolean</a></pre>
<p>Return true when the collection contains elements.</p>
</div>
<div class="api-item"><a name="-androidx.collection.FooSparseArray-.keyIterator--"></a><a name="keyiterator"></a>
<h3 class="api-name" id="(androidx.collection.FooSparseArray).keyIterator()">keyIterator</h3>
<span class="kotlin-platform" data-title="Common/All">Cmn</span>
<!--platform-Common/All-->
<pre class="api-signature no-pretty-print">fun&nbsp;&lt;T&nbsp;:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html">Any</a>?&gt; <a href="/reference/kotlin/androidx/collection/FooSparseArray.html">FooSparseArray</a>&lt;T&gt;.<a href="/reference/kotlin/androidx/collection/FooSparseArray.html#(androidx.collection.FooSparseArray).keyIterator()">keyIterator</a>():&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-long-iterator/index.html">LongIterator</a></pre>
<p>Return an iterator over the collection's keys.</p>
</div>
<div class="api-item"><a name="(androidx.collection.FooSparseArray).set(kotlin.Long, kotlin.Any)"></a><a name="-androidx.collection.FooSparseArray-.set-kotlin.Long-kotlin.Any-"></a><a name="set"></a>
<h3 class="api-name" id="(androidx.collection.FooSparseArray).set(kotlin.Long,kotlin.Any)">set</h3>
<span class="kotlin-platform" data-title="Common/All">Cmn</span>
<!--platform-Common/All-->
<pre class="api-signature no-pretty-print">inline&nbsp;operator&nbsp;fun&nbsp;&lt;T&nbsp;:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html">Any</a>?&gt; <a href="/reference/kotlin/androidx/collection/FooSparseArray.html">FooSparseArray</a>&lt;T&gt;.<a href="/reference/kotlin/androidx/collection/FooSparseArray.html#(androidx.collection.FooSparseArray).set(kotlin.Long,kotlin.Any)">set</a>(key:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html">Long</a>,&nbsp;value:&nbsp;T):&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a></pre>
<p>Allows the use of the index operator for storing values in the collection.</p>
</div>
<div class="api-item"><a name="-androidx.collection.FooSparseArray-.valueIterator--"></a><a name="valueiterator"></a>
<h3 class="api-name" id="(androidx.collection.FooSparseArray).valueIterator()">valueIterator</h3>
<span class="kotlin-platform" data-title="Common/All">Cmn</span>
<!--platform-Common/All-->
<pre class="api-signature no-pretty-print">fun&nbsp;&lt;T&nbsp;:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html">Any</a>?&gt; <a href="/reference/kotlin/androidx/collection/FooSparseArray.html">FooSparseArray</a>&lt;T&gt;.<a href="/reference/kotlin/androidx/collection/FooSparseArray.html#(androidx.collection.FooSparseArray).valueIterator()">valueIterator</a>():&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-iterator/index.html">Iterator</a>&lt;T&gt;</pre>
<p>Return an iterator over the collection's values.</p>
</div>
</div>
</devsite-filter >
<devsite-filter select-el-container-id="platform">
<div class="list">
<h2>Extension properties</h2>
<div class="api-item"><a name="(androidx.collection.FooSparseArray).getSize()"></a><a name="(androidx.collection.FooSparseArray).setSize()"></a><a name="-androidx.collection.FooSparseArray-.getSize--"></a><a name="-androidx.collection.FooSparseArray-.setSize--"></a>
<h3 class="api-name" id="(androidx.collection.FooSparseArray).size()">size</h3>
<span class="kotlin-platform" data-title="Common/All">Cmn</span>
<!--platform-Common/All-->
<pre class="api-signature no-pretty-print">val&nbsp;<a href="/reference/kotlin/androidx/collection/FooSparseArray.html">FooSparseArray</a>&lt;T&gt;.<a href="/reference/kotlin/androidx/collection/FooSparseArray.html#(androidx.collection.FooSparseArray).size()">size</a>:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a></pre>
<p>Returns the number of key/value pairs in the collection.</p>
</div>
</div>
</devsite-filter >
</body>
</html>