remove

Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)
fun <K, V> MutableMap<out K, V>.remove(key: K): V?

Removes the specified key and its corresponding value from this map.

Return

the previous value associated with the key, or null if the key was not present in the map.

Allows to overcome type-safety restriction of remove that requires to pass a key of type K.

Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)
fun <T> MutableCollection<out T>.remove(element: T): Boolean

Removes a single instance of the specified element from this collection, if it is present.

Allows to overcome type-safety restriction of remove that requires to pass an element of type E.

Return true if the element has been successfully removed; false if it was not present in the collection.

Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)
fun <T> MutableList<T>.remove(index: Int): T
Deprecated: Use removeAt(index) instead.

Removes the element at the specified index from this list. In Kotlin one should use the MutableList.removeAt function instead.

Platform and version requirements: JVM (1.2), JRE8 (1.2)
fun <K, V> MutableMap<out K, out V>.remove(
    key: K, 
    value: V
): Boolean

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

© 2010–2020 JetBrains s.r.o. and Kotlin Programming Language contributors
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/remove.html