ArrayMapKt

Added in 1.3.0

public final class ArrayMapKt


Summary

Public methods

static final @NonNull ArrayMap<@NonNull K, @NonNull V>
<K extends Object, V extends Object> arrayMapOf()

Returns an empty new ArrayMap.

static final @NonNull ArrayMap<@NonNull K, @NonNull V>
<K extends Object, V extends Object> arrayMapOf(
    @NonNull Pair<@NonNull K, @NonNull V> pairs
)

Returns a new ArrayMap with the specified contents, given as a list of pairs where the first component is the key and the second component is the value.

Public methods

arrayMapOf

public static final @NonNull ArrayMap<@NonNull K, @NonNull V> <K extends Object, V extends Object> arrayMapOf()

Returns an empty new ArrayMap. NOTE: Consider using mutableScatterMapOf instead. MutableScatterMap also avoids creating a new object per entry but offers better performance characteristics.

public static final @NonNull ArrayMap<@NonNull K, @NonNull V> <K extends Object, V extends Object> arrayMapOf(
    @NonNull Pair<@NonNull K, @NonNull V> pairs
)

Returns a new ArrayMap with the specified contents, given as a list of pairs where the first component is the key and the second component is the value.

If multiple pairs have the same key, the resulting map will contain the value from the last of those pairs.

NOTE: Consider using mutableScatterMapOf instead. MutableScatterMap also avoids creating a new object per entry but offers better performance characteristics.