Add MutableMap.remove(K, V) as built-in declaration

Use PlatformDependent annotation to guarantee it's only be available for JDK8
Also adjust type-safe bridges and mutable collection stubs generation
This commit is contained in:
Denis Zharkov
2016-04-28 09:09:25 +03:00
parent 55c4f875c8
commit d259b91143
41 changed files with 875 additions and 77 deletions
@@ -16,6 +16,8 @@
package kotlin.collections
import kotlin.internal.PlatformDependent
/**
* Classes that inherit from this interface can be represented as a sequence of elements that can
* be iterated over.
@@ -350,6 +352,17 @@ public interface MutableMap<K, V> : Map<K, V> {
*/
public fun remove(key: K): V?
/**
* Removes the entry for the specified key only if it is mapped to the specified value.
*
* @return true if entry was removed
*/
@PlatformDependent
public fun remove(key: K, value: V): Boolean {
// See default implementation in JDK sources
return true
}
// Bulk Modification Operations
/**
* Updates this map with key/value pairs from the specified map [from].