SynchronizedReference

class SynchronizedReference<T : Any>(value: T? = null)

An object reference that may be updated thread-safely.

Constructors

Link copied to clipboard
constructor(value: T? = null)

Functions

Link copied to clipboard
fun get(): T?

Provides an existing T object reference.

Link copied to clipboard
fun getOrCreate(builder: () -> T): T

Provides either an existing T object or creates a new one using builder function.

Link copied to clipboard
fun reset(): Boolean

Drops an existing T object reference to null.

Link copied to clipboard
fun set(value: T?): T?

Accepts value instance of T and holds its reference.