put

abstract fun put(key: K, value: V): V?(source)

Associates key with value, replacing an existing value for an equal key.

A null result may mean an absent key or a previous null value. Use containsKey before mutation when that distinction matters.

Return

the previous value, or null when the key was absent.

Parameters

key

key to insert or update.

value

value to associate with the key.