JS: Drop native map get/set intrinsics altogether.
MutableMap.set extension operator is now common among stdlib and stdlib-js. #KT-2323
This commit is contained in:
@@ -130,6 +130,14 @@ public inline operator fun <@kotlin.internal.OnlyInputTypes K, V> Map<out K, V>.
|
||||
public inline operator fun <@kotlin.internal.OnlyInputTypes K, V> Map<out K, V>.get(key: K): V?
|
||||
= @Suppress("UNCHECKED_CAST") (this as Map<K, V>).get(key)
|
||||
|
||||
/**
|
||||
* Allows to use the index operator for storing values in a mutable map.
|
||||
*/
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline operator fun <K, V> MutableMap<K, V>.set(key: K, value: V): Unit {
|
||||
put(key, value)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns `true` if the map contains the specified [key].
|
||||
*
|
||||
|
||||
@@ -11,14 +11,7 @@ import java.util.SortedMap
|
||||
import java.util.TreeMap
|
||||
import java.util.concurrent.ConcurrentMap
|
||||
|
||||
/**
|
||||
* Allows to use the index operator for storing values in a mutable map.
|
||||
*/
|
||||
// this code is JVM-specific, because JS has native set function
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline operator fun <K, V> MutableMap<K, V>.set(key: K, value: V): Unit {
|
||||
put(key, value)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Concurrent getOrPut, that is safe for concurrent maps.
|
||||
|
||||
Reference in New Issue
Block a user