get Or Create
abstract fun getOrCreate( key: RegKey, sync: Boolean = true, creator: () -> Reference<Any>): Any
Content copied to clipboard
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:
Call the creator function
Store the Reference.next function and associate it to the key for future requests.
Return the Reference.current value.
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.