core-ktx / androidx.util

Package androidx.util

Extensions for External Classes

android.util.AtomicFile

android.util.LongSparseArray

android.util.Pair

android.util.Range

android.util.Size

android.util.SizeF

android.util.SparseArray

android.util.SparseBooleanArray

android.util.SparseIntArray

android.util.SparseLongArray

java.util.Locale

kotlin.Double

kotlin.Float

kotlin.Pair

kotlin.Short

kotlin.String

kotlin.ranges.ClosedRange

Functions

arrayMapOf

fun <K, V> arrayMapOf(): ArrayMap<K, V>

Returns an empty new ArrayMap.

fun <K, V> arrayMapOf(vararg pairs: Pair<K, V>): ArrayMap<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.

arraySetOf

fun <T> arraySetOf(): ArraySet<T>

Returns an empty new ArraySet.

fun <T> arraySetOf(vararg values: T): ArraySet<T>

Returns a new ArraySet with the specified contents.

lruCache

fun <K : Any, V : Any> lruCache(maxSize: Int, sizeOf: (key: K, value: V) -> Int = { _, _ -> 1 }, create: (key: K) -> V? = { null as V? }, onEntryRemoved: (evicted: Boolean, key: K, oldValue: V, newValue: V?) -> Unit = { _, _, _, _ -> }): LruCache<K, V>

Creates an LruCache with the given parameters.

rangeTo

infix fun <T : Comparable<T>> T.rangeTo(that: T): Range<T>

Creates a range from this Comparable value to that.