getOrPut

fun <T : Any> getOrPut(type: KType, key: String, defaultValue: () -> T): T

Gets the value under key as type or puts and returns the value generated by defaultValue if it doesn't exist.

Throws

If type is incompatible with an existing entry and JVM assertions are enabled.


inline fun <T : Any> getOrPut(key: String, noinline defaultValue: () -> T): T

Gets the value under key as T or puts and returns the value generated by defaultValue if it doesn't exist.

Throws

If T is incompatible with an existing entry and JVM assertions are enabled.