get

fun get(type: KClass<*>): T

Returns the value for the given class. If no value has yet been computed, it is obtained by an invocation of the .computeValue method.

The actual installation of the value on the class is performed atomically. At that point, if several racing threads have computed values, one is chosen, and returned to all the racing threads.

The type parameter is typically a class, but it may be any type, such as an interface, a primitive type (like int.class), or void.class.

In the absence of remove calls, a class value has a simple state diagram: uninitialized and initialized. When remove calls are made, the rules for value observation are more complex. See the documentation for .remove for more information.

Return

the current value associated with this ClassValue, for the given class or interface

Parameters

type

the type whose class value must be computed or retrieved

See also

.computeValue

Throws

if the argument is null