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:
@@ -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].
|
||||
|
||||
Reference in New Issue
Block a user