androidx.collection
Classes
ArrayMap |
ArrayMap is a generic key->value mapping data structure that is designed to be more memory efficient than a traditional |
ArraySet |
ArraySet is a generic set data structure that is designed to be more memory efficient than a traditional |
CircularArray |
CircularArray is a generic circular array data structure that provides O(1) random read, O(1) prepend and O(1) append. |
CircularIntArray |
CircularIntArray is a circular integer array data structure that provides O(1) random read, O(1) prepend and O(1) append. |
LongSparseArray |
SparseArray mapping longs to Objects. |
LruCache |
Static library version of |
SimpleArrayMap |
Base implementation of |
SparseArrayCompat |
SparseArrays map integers to Objects. |
Top-level functions summary
ArrayMap<K, V> |
Returns an empty new ArrayMap. |
ArrayMap<K, V> |
arrayMapOf(vararg pairs: Pair<K, V>) 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. |
ArraySet<T> |
Returns an empty new ArraySet. |
ArraySet<T> |
arraySetOf(vararg values: T) Returns a new ArraySet with the specified contents. |
LruCache<K, V> |
lruCache(maxSize: Int, crossinline sizeOf: (key: K, value: V) -> Int = { _, _ -> 1 }, crossinline create: (key: K) -> V? = { null as V? }, crossinline onEntryRemoved: (evicted: Boolean, key: K, oldValue: V, newValue: V?) -> Unit = { _, _, _, _ -> }) Creates an LruCache with the given parameters. |
Extension functions summary
For LongSparseArray | |
operator Boolean |
LongSparseArray<T>.contains(key: Long) Returns true if the collection contains key. |
Unit |
LongSparseArray<T>.forEach(action: (key: Long, value: T) -> Unit) Performs the given action for each key/value entry. |
T |
LongSparseArray<T>.getOrDefault(key: Long, defaultValue: T) Return the value corresponding to key, or defaultValue when not present. |
T |
LongSparseArray<T>.getOrElse(key: Long, defaultValue: () -> T) Return the value corresponding to key, or from defaultValue when not present. |
Boolean |
Return true when the collection contains elements. |
LongIterator |
Return an iterator over the collection's keys. |
operator LongSparseArray<T> |
LongSparseArray<T>.plus(other: LongSparseArray<T>) Creates a new collection by adding or replacing entries from other. |
Boolean |
LongSparseArray<T>.remove(key: Long, value: T) |
operator Unit |
LongSparseArray<T>.set(key: Long, value: T) Allows the use of the index operator for storing values in the collection. |
Iterator<T> |
Return an iterator over the collection's values. |
For SparseArrayCompat | |
operator Boolean |
SparseArrayCompat<T>.contains(key: Int) Returns true if the collection contains key. |
Unit |
SparseArrayCompat<T>.forEach(action: (key: Int, value: T) -> Unit) Performs the given action for each key/value entry. |
T |
SparseArrayCompat<T>.getOrDefault(key: Int, defaultValue: T) Return the value corresponding to key, or defaultValue when not present. |
T |
SparseArrayCompat<T>.getOrElse(key: Int, defaultValue: () -> T) Return the value corresponding to key, or from defaultValue when not present. |
Boolean |
Return true when the collection contains elements. |
IntIterator |
Return an iterator over the collection's keys. |
operator SparseArrayCompat<T> |
SparseArrayCompat<T>.plus(other: SparseArrayCompat<T>) Creates a new collection by adding or replacing entries from other. |
Boolean |
SparseArrayCompat<T>.remove(key: Int, value: T) |
operator Unit |
SparseArrayCompat<T>.set(key: Int, value: T) Allows the use of the index operator for storing values in the collection. |
Iterator<T> |
Return an iterator over the collection's values. |
Extension properties summary
For LongSparseArray | |
Int |
LongSparseArray<T>.size() Returns the number of key/value pairs in the collection. |
For SparseArrayCompat | |
Int |
SparseArrayCompat<T>.size() Returns the number of key/value pairs in the collection. |