fun <V> SparseArray<V>.filter(predicate: (Int, V) -> Boolean): SparseArray<V>
Filters all entries matching given predicate into a new SparseArray. |
|
fun <V> SparseArray<V>.filterTo(destination: SparseArray<V>, predicate: (Int, V) -> Boolean): SparseArray<V>
Writes all entries matching given predicate to destination array. |
|
fun <V> SparseArray<V>.forEach(action: (Int, V) -> Unit): Unit
Performs given action on each key/value pair. |
|
fun <V> SparseArray<V>.getOrPut(key: Int, defaultValue: () -> V): V
Gets value with specific key. If the value is not present, calls defaultValue to obtain a non-null value which is placed into the array, then returned. |
|
operator fun <T> SparseArray<T>.plusAssign(array: SparseArray<T?>): Unit
Copies keys and values from specified SparseArray, overwriting own key/value pairs. |
|
operator fun <T> SparseArray<T>.set(key: Int, value: T?): Unit
Sets value for specified key. |
|
val <T> SparseArray<T>.values: List<T>
Returns a list containing all values in a SparseArray. |