SparseIntArrayKt

Added in 1.1.0

public final class SparseIntArrayKt


Summary

Public methods

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

Returns true if the collection contains key.

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

Returns true if the collection contains key.

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

Returns true if the collection contains value.

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

Performs the given action for each key/value entry.

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

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

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

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

static final int

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

static final boolean

Return true when the collection contains no elements.

static final boolean

Return true when the collection contains elements.

static final @NonNull IntIterator

Return an iterator over the collection's keys.

static final @NonNull SparseIntArray

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

static final void

Update this collection by adding or replacing entries from other.

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

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

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

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

static final @NonNull IntIterator

Return an iterator over the collection's values.

Public methods

contains

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

Returns true if the collection contains key.

containsKey

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

Returns true if the collection contains key.

containsValue

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

Returns true if the collection contains value.

forEach

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

Performs the given action for each key/value entry.

getOrDefault

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

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

getOrElse

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

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

getSize

public static final int getSize(@NonNull SparseIntArray receiver)

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

isEmpty

public static final boolean isEmpty(@NonNull SparseIntArray receiver)

Return true when the collection contains no elements.

isNotEmpty

public static final boolean isNotEmpty(@NonNull SparseIntArray receiver)

Return true when the collection contains elements.

keyIterator

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

Return an iterator over the collection's keys.

plus

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

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

putAll

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

Update this collection by adding or replacing entries from other.

remove

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

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

set

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

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

Return an iterator over the collection's values.