putFirst

open fun putFirst(k: K, v: V): V

Inserts the given mapping into the map if it is not already present, or replaces the value of a mapping if it is already present (optional operation). After this operation completes normally, the given mapping will be present in this map, and it will be the first mapping in this map's encounter order.

Return

the value previously associated with k, or null if none

Parameters

k

the key

v

the value

Throws

if this collection implementation does not support this operation