getOrCreate

open override fun getOrCreate(key: RegKey, sync: Boolean, creator: () -> Reference<Any>): Any

Get or create a value that correspond for the given key.

This function should operate as follow:

  • If there is a function associated to the key, call it, and if the result is not empty, return it.

  • If there is no function associated, or if the function returned null:

Return

A value associated to the key, whether created by creator or retrieved by Reference.next.

Parameters

key

An object representing a "key" to associate.

creator

A function that creates a reference that will be stored in the registry.