intellij-randomness / com.fwdekker.randomness / Cache / get

get

@Synchronized fun get(key: K, useCache: Boolean = true): V

Returns the value that corresponds to key.

If it does not exist, it is instantiated and then returned. If useCache is set to false, a new value is always instantiated, even if there already is a value for key.

Parameters

key - the key to look up the value with

useCache - whether to return the existing value if it exists. Either way, the result is stored in the cache

Return
the value that corresponds to key