Package-level declarations

Properties

Link copied to clipboard

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

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

Functions

Link copied to clipboard
@RequiresApi(value = 21)
infix inline fun <T : Comparable<T>> Range<T>.and(other: Range<T>): Range<T>

Return the intersection of this range and other.

Link copied to clipboard

Returns a Consumer that will resume this Continuation when the result of an operation is accepted.

Link copied to clipboard

Returns a java.util.function.Consumer that will resume this Continuation when the result of an operation is accepted.

Link copied to clipboard

Returns a Runnable that will resume this Continuation when an operation completes and the returned Runnable's Runnable.run method is called.

Link copied to clipboard
inline operator fun <F, S> Pair<F, S>.component1(): F
inline operator fun <F, S> Pair<F, S>.component1(): F

Returns the first component of the pair.

@RequiresApi(value = 21)
inline operator fun Size.component1(): Int

Returns "width", the first component of this Size.

@RequiresApi(value = 21)
inline operator fun SizeF.component1(): Float

Returns "width", the first component of this SizeF.

inline operator fun SizeFCompat.component1(): Float

Returns "width", the first component of this SizeFCompat.

Link copied to clipboard
inline operator fun <F, S> Pair<F, S>.component2(): S
inline operator fun <F, S> Pair<F, S>.component2(): S

Returns the second component of the pair.

@RequiresApi(value = 21)
inline operator fun Size.component2(): Int

Returns "height", the second component of this Size.

@RequiresApi(value = 21)
inline operator fun SizeF.component2(): Float

Returns "height", the second component of this SizeF.

inline operator fun SizeFCompat.component2(): Float

Returns "height", the second component of this SizeFCompat.

Link copied to clipboard
inline operator fun <T> LongSparseArray<T>.contains(key: Long): Boolean
inline operator fun <T> SparseArray<T>.contains(key: Int): Boolean
inline operator fun SparseBooleanArray.contains(key: Int): Boolean
inline operator fun SparseIntArray.contains(key: Int): Boolean
inline operator fun SparseLongArray.contains(key: Int): Boolean

Returns true if the collection contains key.

Link copied to clipboard
inline fun <T> LongSparseArray<T>.containsKey(key: Long): Boolean
inline fun <T> SparseArray<T>.containsKey(key: Int): Boolean

Returns true if the collection contains key.

Link copied to clipboard
inline fun <T> LongSparseArray<T>.containsValue(value: T): Boolean
inline fun <T> SparseArray<T>.containsValue(value: T): Boolean

Returns true if the collection contains value.

Link copied to clipboard
inline fun <T> LongSparseArray<T>.forEach(action: (key: Long, value: T) -> Unit)
inline fun <T> SparseArray<T>.forEach(action: (key: Int, value: T) -> Unit)
inline fun SparseBooleanArray.forEach(action: (key: Int, value: Boolean) -> Unit)
inline fun SparseIntArray.forEach(action: (key: Int, value: Int) -> Unit)
inline fun SparseLongArray.forEach(action: (key: Int, value: Long) -> Unit)

Performs the given action for each key/value entry.

Link copied to clipboard
inline fun <T> LongSparseArray<T>.getOrDefault(key: Long, defaultValue: T): T
inline fun <T> SparseArray<T>.getOrDefault(key: Int, defaultValue: T): T
inline fun SparseBooleanArray.getOrDefault(key: Int, defaultValue: Boolean): Boolean
inline fun SparseIntArray.getOrDefault(key: Int, defaultValue: Int): Int
inline fun SparseLongArray.getOrDefault(key: Int, defaultValue: Long): Long

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

Link copied to clipboard
inline fun <T> LongSparseArray<T>.getOrElse(key: Long, defaultValue: () -> T): T
inline fun <T> SparseArray<T>.getOrElse(key: Int, defaultValue: () -> T): T
inline fun SparseBooleanArray.getOrElse(key: Int, defaultValue: () -> Boolean): Boolean
inline fun SparseIntArray.getOrElse(key: Int, defaultValue: () -> Int): Int
inline fun SparseLongArray.getOrElse(key: Int, defaultValue: () -> Long): Long

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

Link copied to clipboard
inline fun <T> LongSparseArray<T>.isEmpty(): Boolean
inline fun <T> SparseArray<T>.isEmpty(): Boolean

Return true when the collection contains no elements.

Link copied to clipboard
inline fun <T> SparseArray<T>.isNotEmpty(): Boolean

Return true when the collection contains elements.

Link copied to clipboard
inline fun <K : Any, V : Any> 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 = { _, _, _, _ -> }): LruCache<K, V>

Creates an LruCache with the given parameters.

Link copied to clipboard
operator fun <T> SparseArray<T>.plus(other: SparseArray<T>): SparseArray<T>

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

@RequiresApi(value = 21)
inline operator fun <T : Comparable<T>> Range<T>.plus(value: T): Range<T>

Return the smallest range that includes this and value.

@RequiresApi(value = 21)
inline operator fun <T : Comparable<T>> Range<T>.plus(other: Range<T>): Range<T>

Return the smallest range that includes this and other.

Link copied to clipboard
fun <T> SparseArray<T>.putAll(other: SparseArray<T>)

Update this collection by adding or replacing entries from other.

Link copied to clipboard
@RequiresApi(value = 21)
infix inline fun <T : Comparable<T>> T.rangeTo(that: T): Range<T>

Creates a range from this Comparable value to that.

Link copied to clipboard

Gets the entire content of this file as a byte array.

Link copied to clipboard
fun AtomicFile.readText(charset: Charset = Charsets.UTF_8): String

Gets the entire content of this file as a String using UTF-8 or specified charset.

Link copied to clipboard
fun <T> LongSparseArray<T>.remove(key: Long, value: T): Boolean
fun <T> SparseArray<T>.remove(key: Int, value: T): Boolean
fun SparseIntArray.remove(key: Int, value: Int): Boolean

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

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

Link copied to clipboard
inline operator fun <T> LongSparseArray<T>.set(key: Long, value: T)
inline operator fun <T> SparseArray<T>.set(key: Int, value: T)
inline operator fun SparseBooleanArray.set(key: Int, value: Boolean)
inline operator fun SparseIntArray.set(key: Int, value: Int)
inline operator fun SparseLongArray.set(key: Int, value: Long)

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

Link copied to clipboard
inline fun <F, S> Pair<F, S>.toAndroidPair(): Pair<F, S>

Returns this Kotlin Pair as an Android Pair.

Link copied to clipboard
inline fun <F, S> Pair<F, S>.toAndroidXPair(): Pair<F, S>

Returns this Kotlin Pair as an AndroidX Pair.

Link copied to clipboard

Returns this Range as a ClosedRange.

Link copied to clipboard
@RequiresApi(value = 26)
inline fun Double.toHalf(): Half

Returns a Half instance representing given Double.

@RequiresApi(value = 26)
inline fun Float.toHalf(): Half

Returns a Half instance representing given Float.

@RequiresApi(value = 26)
inline fun Short.toHalf(): Half

Returns a Half instance representing given Short.

@RequiresApi(value = 26)
inline fun String.toHalf(): Half

Returns a Half instance representing given String.

Link copied to clipboard
inline fun <F, S> Pair<F, S>.toKotlinPair(): Pair<F, S>

Returns this Android Pair as a Kotlin Pair.

inline fun <F, S> Pair<F, S>.toKotlinPair(): Pair<F, S>

Returns this AndroidX Pair as a Kotlin Pair.

Link copied to clipboard
@RequiresApi(value = 21)
fun <T : Comparable<T>> ClosedRange<T>.toRange(): Range<T>

Returns this ClosedRange as a Range.

Link copied to clipboard
inline fun AtomicFile.tryWrite(block: (out: FileOutputStream) -> Unit)

Perform the write operations inside block on this file. If block throws an exception the write will be failed. Otherwise the write will be applied atomically to the file.

Link copied to clipboard

Sets the content of this file as an array of bytes.

Link copied to clipboard
fun AtomicFile.writeText(text: String, charset: Charset = Charsets.UTF_8)

Sets the content of this file as text encoded using UTF-8 or specified charset. If this file exists, it becomes overwritten.