remove

open override fun remove(key: K): V?

Removes the mapping for this key from this TreeMap if present.

Return

the previous value associated with key, or null if there was no mapping. (A null return can also indicate that the map previously associated null with key.)

Parameters

key

key whose mapping is to be removed from the map

Throws

if the key cannot be compared

if key is null and nulls are not supported


fun remove(key: K, value: V): Boolean

Removes the entry for the specified key only if it is currently mapped to the specified value.

Return

true if the value was removed

Parameters

key

key with which the specified value is associated

value

value expected to be associated with the specified key

Throws

if the key cannot be compared

if key is null and nulls are not supported