put

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

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

Replacement retains the original stored key and does not invalidate iterators. Inserting a new key increases size, may grow the table and invalidates existing iterators. A null result can also mean that the previous value was null; use containsKey before mutation to distinguish absence.

Return

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

Parameters

key

key to insert or update, with stable equality and hashing while stored.

value

value to associate with the key.

Throws

if inserting a new key exceeds the supported size or bucket capacity.