Make MutableMap.set return Unit

#KT-7853 Fixed
This commit is contained in:
Ilya Gorbunov
2015-11-09 21:58:27 +03:00
parent 7844030ba4
commit a8b11ff07b
@@ -14,7 +14,13 @@ 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
public operator fun <K, V> MutableMap<K, V>.set(key: K, value: V): V? = put(key, value)
public operator fun <K, V> MutableMap<K, V>.set(key: K, value: V): Unit {
put(key, value)
}
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
@JvmName("set")
public fun <K, V> MutableMap<K, V>.set(key: K, value: V): V? = put(key, value)
/**
* getOrPut is not supported on [ConcurrentMap] since it cannot be implemented correctly in terms of concurrency.