SparseArrayKt

public final class SparseArrayKt


Summary

Public fields

final int

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

Public methods

static final boolean
<T extends Object> SparseArrayKt.contains(SparseArray<T> receiver, int key)

Returns true if the collection contains key.

static final boolean
<T extends Object> SparseArrayKt.containsKey(SparseArray<T> receiver, int key)

Returns true if the collection contains key.

static final boolean
<T extends Object> SparseArrayKt.containsValue(SparseArray<T> receiver, T value)

Returns true if the collection contains value.

static final void
<T extends Object> SparseArrayKt.forEach(
    SparseArray<T> receiver,
    Function2<Integer, value, Unit> action
)

Performs the given action for each key/value entry.

static final @NonNull T
<T extends Object> SparseArrayKt.getOrDefault(
    SparseArray<T> receiver,
    int key,
    T defaultValue
)

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

static final @NonNull T
<T extends Object> SparseArrayKt.getOrElse(
    SparseArray<T> receiver,
    int key,
    Function0<T> defaultValue
)

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

static final boolean
<T extends Object> SparseArrayKt.isEmpty(SparseArray<T> receiver)

Return true when the collection contains no elements.

static final boolean
<T extends Object> SparseArrayKt.isNotEmpty(SparseArray<T> receiver)

Return true when the collection contains elements.

static final @NonNull IntIterator
<T extends Object> SparseArrayKt.keyIterator(SparseArray<T> receiver)

Return an iterator over the collection's keys.

static final @NonNull SparseArray<@NonNull T>
<T extends Object> SparseArrayKt.plus(
    SparseArray<T> receiver,
    SparseArray<T> other
)

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

static final void
<T extends Object> SparseArrayKt.putAll(
    SparseArray<T> receiver,
    SparseArray<T> other
)

Update this collection by adding or replacing entries from other.

static final boolean
<T extends Object> SparseArrayKt.remove(
    SparseArray<T> receiver,
    int key,
    T value
)

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

static final void
<T extends Object> SparseArrayKt.set(SparseArray<T> receiver, int key, T value)

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

static final @NonNull Iterator<@NonNull T>
<T extends Object> SparseArrayKt.valueIterator(SparseArray<T> receiver)

Return an iterator over the collection's values.

Public fields

size

public final int size

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

Public methods

SparseArrayKt.contains

public static final boolean <T extends Object> SparseArrayKt.contains(SparseArray<T> receiver, int key)

Returns true if the collection contains key.

SparseArrayKt.containsKey

public static final boolean <T extends Object> SparseArrayKt.containsKey(SparseArray<T> receiver, int key)

Returns true if the collection contains key.

SparseArrayKt.containsValue

public static final boolean <T extends Object> SparseArrayKt.containsValue(SparseArray<T> receiver, T value)

Returns true if the collection contains value.

SparseArrayKt.forEach

public static final void <T extends Object> SparseArrayKt.forEach(
    SparseArray<T> receiver,
    Function2<Integer, value, Unit> action
)

Performs the given action for each key/value entry.

SparseArrayKt.getOrDefault

public static final @NonNull T <T extends Object> SparseArrayKt.getOrDefault(
    SparseArray<T> receiver,
    int key,
    T defaultValue
)

Return the value corresponding to key, or defaultValue whe