core-ktx / androidx.util / android.util.SparseBooleanArray

Extensions for android.util.SparseBooleanArray

contains

operator fun SparseBooleanArray.contains(key: Int): Boolean

Returns true if the collection contains key.

containsKey

fun SparseBooleanArray.containsKey(key: Int): Boolean

Returns true if the collection contains key.

containsValue

fun SparseBooleanArray.containsValue(value: Boolean): Boolean

Returns true if the collection contains value.

forEach

fun SparseBooleanArray.forEach(action: (key: Int, value: Boolean) -> Unit): Unit

Performs the given action for each key/value entry.

getOrDefault

fun SparseBooleanArray.getOrDefault(key: Int, defaultValue: Boolean): Boolean

Return the value corresponding to key, or defaultValue when not present.

getOrElse

fun SparseBooleanArray.getOrElse(key: Int, defaultValue: () -> Boolean): Boolean

Return the value corresponding to key, or from defaultValue when not present.

isEmpty

fun SparseBooleanArray.isEmpty(): Boolean

Return true when the collection contains no elements.

isNotEmpty

fun SparseBooleanArray.isNotEmpty(): Boolean

Return true when the collection contains elements.

keyIterator

fun SparseBooleanArray.keyIterator(): IntIterator

Return an iterator over the collection's keys.

plus

operator fun SparseBooleanArray.plus(other: SparseBooleanArray): SparseBooleanArray

Creates a new collection by adding or replacing entries from other.

putAll

fun SparseBooleanArray.putAll(other: SparseBooleanArray): Unit

Update this collection by adding or replacing entries from other.

remove

fun SparseBooleanArray.remove(key: Int, value: Boolean): Boolean

Removes the entry for key only if it is mapped to value.

removeAt

fun SparseBooleanArray.removeAt(index: Int): Unit

Removes the mapping at the specified index.

set

operator fun SparseBooleanArray.set(key: Int, value: Boolean): Unit

Allows the use of the index operator for storing values in the collection.

size

val SparseBooleanArray.size: Int

Returns the number of key/value pairs in the collection.

valueIterator

fun SparseBooleanArray.valueIterator(): BooleanIterator

Return an iterator over the collection's values.