SparseBooleanArrayKt

Added in 1.19.0

public final class SparseBooleanArrayKt


Summary

Public methods

static final boolean
all(
    @NonNull SparseBooleanArray receiver,
    @NonNull Function2<@NonNull Integer, @NonNull Boolean, @NonNull Boolean> predicate
)

Returns true if all entries match the given predicate.

static final boolean
any(
    @NonNull SparseBooleanArray receiver,
    @NonNull Function2<@NonNull Integer, @NonNull Boolean, @NonNull Boolean> predicate
)

Returns true if at least one entry matches the given predicate.

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

Returns true if the collection contains key.

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

Returns true if the collection contains key.

static final boolean
containsValue(@NonNull SparseBooleanArray receiver, boolean value)

Returns true if the collection contains value.

static final void
forEach(
    @NonNull SparseBooleanArray receiver,
    @NonNull Function2<@NonNull Integer, @NonNull Boolean, Unit> action
)

Performs the given action for each key/value entry.

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

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

static final boolean
getOrElse(
    @NonNull SparseBooleanArray receiver,
    int key,
    @NonNull Function0<@NonNull Boolean> defaultValue
)

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

static final boolean
getOrPut(
    @NonNull SparseBooleanArray receiver,
    int key,
    @NonNull Function0<@NonNull Boolean> defaultValue
)

Return the value corresponding to key, or put the defaultValue into the collection 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 boolean
none(
    @NonNull SparseBooleanArray receiver,
    @NonNull Function2<@NonNull Integer, @NonNull Boolean, @NonNull Boolean> predicate
)

Returns true if no entries match the given predicate.

static final @NonNull SparseBooleanArray
plus(
    @NonNull SparseBooleanArray receiver,
    @NonNull SparseBooleanArray other
)

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

static final void
putAll(
    @NonNull SparseBooleanArray receiver,
    @NonNull SparseBooleanArray other
)

Update this collection by adding or replacing entries from other.

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

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

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

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

static final @NonNull SparseBooleanArray

Returns an empty SparseBooleanArray.

static final @NonNull SparseBooleanArray

Returns a new SparseBooleanArray filled with the specified pairs.

static final @NonNull BooleanIterator

Return an iterator over the collection's values.

Public methods

public static final boolean all(
    @NonNull SparseBooleanArray receiver,
    @NonNull Function2<@NonNull Integer, @NonNull Boolean, @NonNull Boolean> predicate
)

Returns true if all entries match the given predicate.

public static final boolean any(
    @NonNull SparseBooleanArray receiver,
    @NonNull Function2<@NonNull Integer, @NonNull Boolean, @NonNull Boolean> predicate
)

Returns true if at least one entry matches the given predicate.

contains

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

Returns true if the collection contains key.

containsKey

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

Returns true if the collection contains key.

containsValue

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

Returns true if the collection contains value.

forEach

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

Performs the given action for each key/value entry.

getOrDefault

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

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

getOrElse

public static final boolean getOrElse(
    @NonNull SparseBooleanArray receiver,
    int key,
    @NonNull Function0<@NonNull Boolean> defaultValue
)

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

getOrPut

public static final boolean getOrPut(
    @NonNull SparseBooleanArray receiver,
    int key,
    @NonNull Function0<@NonNull Boolean> defaultValue
)

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

getSize

public static final int getSize(@NonNull SparseBooleanArray receiver)

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

isEmpty

public static final boolean isEmpty(@NonNull SparseBooleanArray receiver)

Return true when the collection contains no elements.

isNotEmpty

public static final boolean isNotEmpty(@NonNull SparseBooleanArray receiver)

Return true when the collection contains elements.

keyIterator

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

Return an iterator over the collection's keys.

public static final boolean none(
    @NonNull SparseBooleanArray receiver,
    @NonNull Function2<@NonNull Integer, @NonNull Boolean, @NonNull Boolean> predicate
)

Returns true if no entries match the given predicate.

plus

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

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

putAll

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

Update this collection by adding or replacing entries from other.

remove

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

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

set

public static final void set(@NonNull SparseBooleanArray receiver, int key, boolean value)

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

sparseBooleanArrayOf

public static final @NonNull SparseBooleanArray sparseBooleanArrayOf()

Returns an empty SparseBooleanArray.

sparseBooleanArrayOf

public static final @NonNull SparseBooleanArray sparseBooleanArrayOf(
    @NonNull Pair<@NonNull Integer, @NonNull Boolean>... pairs
)

Returns a new SparseBooleanArray filled with the specified pairs.

valueIterator

public static final @NonNull BooleanIterator valueIterator(@NonNull SparseBooleanArray receiver)

Return an iterator over the collection's values.