Package-level declarations

Types

Link copied to clipboard
interface KReadOnlyProperty<in T, out V>

A delegate interface extending similar to ReadOnlyProperty, but providing a more function onDelegate which contains thisRef and property.

Link copied to clipboard

A delegate interface extending from KReadOnlyProperty and providing setValue.

Functions

Link copied to clipboard
inline fun <T> allDo(vararg elements: T, act: (T) -> Unit)

Makes all elements of the nearest shared type T.

Link copied to clipboard
inline fun <T> fastLazy(crossinline initialize: () -> T): ReadWriteProperty<Any?, T>

Simplifies from lazy(LazyThreadSafetyMode.NONE){ ... }, and is mutable.

Link copied to clipboard
inline fun <T, V> MutableMap<T, V>.getOrPutNullable(key: T, getValue: (T) -> V): V

Solves the nullability bug of MutableMap.getOrPut.

Link copied to clipboard
inline fun <T : Any, V> receivedLazy(lock: Any, crossinline initialize: (T) -> V): ReadOnlyProperty<T, V>

Passes the receiver of T to initialize a lazy value easily with lock.

inline fun <T : Any, V> receivedLazy(mode: LazyThreadSafetyMode = LazyThreadSafetyMode.SYNCHRONIZED, crossinline initialize: (T) -> V): ReadOnlyProperty<T, V>

Passes the receiver of T to initialize a lazy value easily with mode.

Link copied to clipboard
fun <E> MutableList<E>.swap(i: Int, j: Int)

Swap values between elements at i and j.

Link copied to clipboard

Returns a string with a right postfix after this.

Link copied to clipboard
inline fun <T> T.updateIf(predicate: (T) -> Boolean, update: (T) -> T): T

Returns the updated value if this matches predicate, or this if not. This is very helpful in the linked operations.