# SparseIntArrayKt

Added in 1.1.0

*** ** * ** ***


```
public final class SparseIntArrayKt
```

<br />

*** ** * ** ***

## Summary

| ### Public methods |
|---|---|
| `static final boolean` | `https://developer.android.com/reference/androidx/core/util/SparseIntArrayKt#(android.util.SparseIntArray).contains(kotlin.Int)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/util/SparseIntArray.html receiver, int key)` Returns true if the collection contains `https://developer.android.com/reference/androidx/core/util/package-summary#(android.util.SparseIntArray).contains(kotlin.Int)`. |
| `static final boolean` | `https://developer.android.com/reference/androidx/core/util/SparseIntArrayKt#(android.util.SparseIntArray).containsKey(kotlin.Int)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/util/SparseIntArray.html receiver, int key)` Returns true if the collection contains `https://developer.android.com/reference/androidx/core/util/package-summary#(android.util.SparseIntArray).containsKey(kotlin.Int)`. |
| `static final boolean` | `https://developer.android.com/reference/androidx/core/util/SparseIntArrayKt#(android.util.SparseIntArray).containsValue(kotlin.Int)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/util/SparseIntArray.html receiver, int value)` Returns true if the collection contains `https://developer.android.com/reference/androidx/core/util/package-summary#(android.util.SparseIntArray).containsValue(kotlin.Int)`. |
| `static final void` | `https://developer.android.com/reference/androidx/core/util/SparseIntArrayKt#(android.util.SparseIntArray).forEach(kotlin.Function2)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/util/SparseIntArray.html receiver, @https://developer.android.com/reference/androidx/annotation/NonNull Function2<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Integer.html, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Integer.html, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> action )` Performs the given `https://developer.android.com/reference/androidx/core/util/package-summary#(android.util.SparseIntArray).forEach(kotlin.Function2)` for each key/value entry. |
| `static final int` | `https://developer.android.com/reference/androidx/core/util/SparseIntArrayKt#(android.util.SparseIntArray).getOrDefault(kotlin.Int,kotlin.Int)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/util/SparseIntArray.html receiver, int key, int defaultValue)` Return the value corresponding to `https://developer.android.com/reference/androidx/core/util/package-summary#(android.util.SparseIntArray).getOrDefault(kotlin.Int,kotlin.Int)`, or `https://developer.android.com/reference/androidx/core/util/package-summary#(android.util.SparseIntArray).getOrDefault(kotlin.Int,kotlin.Int)` when not present. |
| `static final int` | `https://developer.android.com/reference/androidx/core/util/SparseIntArrayKt#(android.util.SparseIntArray).getOrElse(kotlin.Int,kotlin.Function0)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/util/SparseIntArray.html receiver, int key, @https://developer.android.com/reference/androidx/annotation/NonNull Function0<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Integer.html> defaultValue )` Return the value corresponding to `https://developer.android.com/reference/androidx/core/util/package-summary#(android.util.SparseIntArray).getOrElse(kotlin.Int,kotlin.Function0)`, or from `https://developer.android.com/reference/androidx/core/util/package-summary#(android.util.SparseIntArray).getOrElse(kotlin.Int,kotlin.Function0)` when not present. |
| `static final int` | `https://developer.android.com/reference/androidx/core/util/SparseIntArrayKt#(android.util.SparseIntArray).getSize()(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/util/SparseIntArray.html receiver)` Returns the number of key/value pairs in the collection. |
| `static final boolean` | `https://developer.android.com/reference/androidx/core/util/SparseIntArrayKt#(android.util.SparseIntArray).isEmpty()(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/util/SparseIntArray.html receiver)` Return true when the collection contains no elements. |
| `static final boolean` | `https://developer.android.com/reference/androidx/core/util/SparseIntArrayKt#(android.util.SparseIntArray).isNotEmpty()(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/util/SparseIntArray.html receiver)` Return true when the collection contains elements. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-int-iterator/index.html` | `https://developer.android.com/reference/androidx/core/util/SparseIntArrayKt#(android.util.SparseIntArray).keyIterator()(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/util/SparseIntArray.html receiver)` Return an iterator over the collection's keys. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/util/SparseIntArray.html` | `https://developer.android.com/reference/androidx/core/util/SparseIntArrayKt#(android.util.SparseIntArray).plus(android.util.SparseIntArray)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/util/SparseIntArray.html receiver, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/util/SparseIntArray.html other)` Creates a new collection by adding or replacing entries from `https://developer.android.com/reference/androidx/core/util/package-summary#(android.util.SparseIntArray).plus(android.util.SparseIntArray)`. |
| `static final void` | `https://developer.android.com/reference/androidx/core/util/SparseIntArrayKt#(android.util.SparseIntArray).putAll(android.util.SparseIntArray)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/util/SparseIntArray.html receiver, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/util/SparseIntArray.html other)` Update this collection by adding or replacing entries from `https://developer.android.com/reference/androidx/core/util/package-summary#(android.util.SparseIntArray).putAll(android.util.SparseIntArray)`. |
| `static final boolean` | `https://developer.android.com/reference/androidx/core/util/SparseIntArrayKt#(android.util.SparseIntArray).remove(kotlin.Int,kotlin.Int)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/util/SparseIntArray.html receiver, int key, int value)` Removes the entry for `https://developer.android.com/reference/androidx/core/util/package-summary#(android.util.SparseIntArray).remove(kotlin.Int,kotlin.Int)` only if it is mapped to `https://developer.android.com/reference/androidx/core/util/package-summary#(android.util.SparseIntArray).remove(kotlin.Int,kotlin.Int)`. |
| `static final void` | `https://developer.android.com/reference/androidx/core/util/SparseIntArrayKt#(android.util.SparseIntArray).set(kotlin.Int,kotlin.Int)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/util/SparseIntArray.html receiver, int key, int value)` Allows the use of the index operator for storing values in the collection. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-int-iterator/index.html` | `https://developer.android.com/reference/androidx/core/util/SparseIntArrayKt#(android.util.SparseIntArray).valueIterator()(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/util/SparseIntArray.html receiver)` Return an iterator over the collection's values. |

## Public methods

### contains

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/util/SparseIntArray.kt+function:contains) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public static final boolean contains(@NonNull SparseIntArray receiver, int key)
```

Returns true if the collection contains `https://developer.android.com/reference/androidx/core/util/package-summary#(android.util.SparseIntArray).contains(kotlin.Int)`.

### containsKey

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/util/SparseIntArray.kt+function:containsKey) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public static final boolean containsKey(@NonNull SparseIntArray receiver, int key)
```

Returns true if the collection contains `https://developer.android.com/reference/androidx/core/util/package-summary#(android.util.SparseIntArray).containsKey(kotlin.Int)`.

### containsValue

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/util/SparseIntArray.kt+function:containsValue) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public static final boolean containsValue(@NonNull SparseIntArray receiver, int value)
```

Returns true if the collection contains `https://developer.android.com/reference/androidx/core/util/package-summary#(android.util.SparseIntArray).containsValue(kotlin.Int)`.

### forEach

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/util/SparseIntArray.kt+function:forEach) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public static final void forEach(
    @NonNull SparseIntArray receiver,
    @NonNull Function2<@NonNull Integer, @NonNull Integer, Unit> action
)
```

Performs the given `https://developer.android.com/reference/androidx/core/util/package-summary#(android.util.SparseIntArray).forEach(kotlin.Function2)` for each key/value entry.

### getOrDefault

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/util/SparseIntArray.kt+function:getOrDefault) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public static final int getOrDefault(@NonNull SparseIntArray receiver, int key, int defaultValue)
```

Return the value corresponding to `https://developer.android.com/reference/androidx/core/util/package-summary#(android.util.SparseIntArray).getOrDefault(kotlin.Int,kotlin.Int)`, or `https://developer.android.com/reference/androidx/core/util/package-summary#(android.util.SparseIntArray).getOrDefault(kotlin.Int,kotlin.Int)` when not present.

### getOrElse

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/util/SparseIntArray.kt+function:getOrElse) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public static final int getOrElse(
    @NonNull SparseIntArray receiver,
    int key,
    @NonNull Function0<@NonNull Integer> defaultValue
)
```

Return the value corresponding to `https://developer.android.com/reference/androidx/core/util/package-summary#(android.util.SparseIntArray).getOrElse(kotlin.Int,kotlin.Function0)`, or from `https://developer.android.com/reference/androidx/core/util/package-summary#(android.util.SparseIntArray).getOrElse(kotlin.Int,kotlin.Function0)` when not present.

### getSize

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/util/SparseIntArray.kt+symbol:size) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public static final int getSize(@NonNull SparseIntArray receiver)
```

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

### isEmpty

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/util/SparseIntArray.kt+function:isEmpty) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public static final boolean isEmpty(@NonNull SparseIntArray receiver)
```

Return true when the collection contains no elements.

### isNotEmpty

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/util/SparseIntArray.kt+function:isNotEmpty) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public static final boolean isNotEmpty(@NonNull SparseIntArray receiver)
```

Return true when the collection contains elements.

### keyIterator

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/util/SparseIntArray.kt+function:keyIterator) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public static final @NonNull IntIterator keyIterator(@NonNull SparseIntArray receiver)
```

Return an iterator over the collection's keys.

### plus

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/util/SparseIntArray.kt+function:plus) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public static final @NonNull SparseIntArray plus(@NonNull SparseIntArray receiver, @NonNull SparseIntArray other)
```

Creates a new collection by adding or replacing entries from `https://developer.android.com/reference/androidx/core/util/package-summary#(android.util.SparseIntArray).plus(android.util.SparseIntArray)`.

### putAll

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/util/SparseIntArray.kt+function:putAll) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public static final void putAll(@NonNull SparseIntArray receiver, @NonNull SparseIntArray other)
```

Update this collection by adding or replacing entries from `https://developer.android.com/reference/androidx/core/util/package-summary#(android.util.SparseIntArray).putAll(android.util.SparseIntArray)`.

### remove

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/util/SparseIntArray.kt+function:remove) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public static final boolean remove(@NonNull SparseIntArray receiver, int key, int value)
```

Removes the entry for `https://developer.android.com/reference/androidx/core/util/package-summary#(android.util.SparseIntArray).remove(kotlin.Int,kotlin.Int)` only if it is mapped to `https://developer.android.com/reference/androidx/core/util/package-summary#(android.util.SparseIntArray).remove(kotlin.Int,kotlin.Int)`.

### set

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/util/SparseIntArray.kt+function:set) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public static final void set(@NonNull SparseIntArray receiver, int key, int value)
```

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

### valueIterator

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/util/SparseIntArray.kt+function:valueIterator) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public static final @NonNull IntIterator valueIterator(@NonNull SparseIntArray receiver)
```

Return an iterator over the collection's values.