BaseDoubleCheck

abstract class BaseDoubleCheck<T>(provider: Provider<T>) : SynchronizedObject, Provider<T> , Lazy<T> (source)

A Lazy and Provider implementation that memoizes the value returned from a provider. The provider instance is released after it's called.

Modification notes:

  • Some semantics from the kotlin stdlib's synchronized Lazy impl are ported to here.

  • Uses AtomicFu's synchronized + SynchronizedObject APIs for KMP support.

  • The _value will eagerly return if initialized

  • _value is @Volatile

Inheritors

Constructors

Link copied to clipboard
constructor(provider: Provider<T>)

Properties

Link copied to clipboard
open override val value: T

Functions

Link copied to clipboard
inline fun <T, R> Provider<T>.flatMap(crossinline transform: (T) -> Provider<R>): Provider<R>

Lazily maps this Provider's value to another Provider of type R.

Link copied to clipboard
open operator override fun invoke(): T
Link copied to clipboard
open override fun isInitialized(): Boolean
Link copied to clipboard
inline fun <T, R> Provider<T>.map(crossinline transform: (T) -> R): Provider<R>

Lazily maps this Provider's value to another Provider of type R.

Link copied to clipboard

Returns a memoizing Provider instance of this provider.

Link copied to clipboard

Returns a memoizing Lazy instance of this provider.

Link copied to clipboard
inline fun <T, R, V> Provider<T>.zip(other: Provider<R>, crossinline transform: (T, R) -> V): Provider<V>

Lazily zips this Provider's value with another Provider of type R and returns a Provider of type V.