OnceSupplier

class OnceSupplier<T : Any>(innerSupplier: () -> T) : Function0<T>

Converts any supplier into one that caches its value upon first evaluation, returning the same value thereafter. The supplier must not produce null.

Parameters

T

The type of value being supplied. Must not be nullable.

innerSupplier

The supplier to be evaluated at most once.

Constructors

Link copied to clipboard
fun <T : Any> OnceSupplier(innerSupplier: () -> T)

Create a OnceSupplier from the given supplier.

Functions

Link copied to clipboard
open operator override fun invoke(): T