setValue

inline operator fun <V> WeakMap<String, V>.setValue(thisRef: Any?, property: KProperty<*>, value: V)(source)

Allows to use a weak map for data-oriented usage.

Example

val map = WeakMap<String, Int>()

var score by map
var age by map

score = 5
println(age)

See also

Equivalent method for regular maps.