DeferredValue

interface DeferredValue<out T> : Comparable<DeferredValue<*>>

A container for a value that is possibly computed lazily.

Inheritors

Types

Link copied to clipboard
object Companion
Link copied to clipboard
class Direct<T>(val value: T) : DeferredValue<T>

A DeferredValue that is directly initialized with a value. Generates a new sequence number when created.

Link copied to clipboard
class Lazy<T>(lazy: Lazy<T>) : DeferredValue<T>

A DeferredValue that is backed by lazy. Generates a new sequence number when created.

Link copied to clipboard
class Mapped<P, T>(val parent: DeferredValue<P>, val transform: (P) -> T) : DeferredValue<T>

A DeferredValue that is the result of applying transform to the value of parent. Inherits the sequence number from parent.

Link copied to clipboard
class MappedMulti<P, T>(val parents: List<DeferredValue<P>>, val transform: (List<P>) -> T) : DeferredValue<T>

A DeferredValue that is the result of applying transform to the values of all parents. Inherits the highest sequence number of all parents.

Link copied to clipboard
class ReEmitted<T>(val parent: DeferredValue<T>) : DeferredValue<T>

A DeferredValue that delegates its value to parent but generates a new sequence number when created.

Properties

Link copied to clipboard
abstract val seqNo: Long

The sequence number of this DeferredValue. The sequence number defines the "age" of the value, where a lower sequence number indicates an older value. Sequence numbers are unique for each DeferredValue chain, but are the same for all DeferredValues that are derived from the same source. Use nextSeqNo to generate a new unique sequence number.

Link copied to clipboard
abstract val value: T

The possibly lazily initialized value of this DeferredValue. Retrieving this value will initialize it if it hasn't been initialized yet. Once initialized, the value will not change.

Functions

Link copied to clipboard
open operator override fun compareTo(other: DeferredValue<*>): Int

Compares this DeferredValue with another DeferredValue based on their seqNo. Equivalent to seqNo.compareTo(other.seqNo).