putAll

expect open override fun putAll(from: Map<out K, V>)(source)

Updates this map with key/value pairs from the specified map from.

Since Kotlin

1.3

Samples

import kotlin.test.*
import java.util.*

fun main() { 
   //sampleStart 
   val map = mutableMapOf(1 to "one", 2 to "two")
map.putAll(mapOf(3 to "three", 4 to "four", 1 to "_ONE_"))

println(map) // {1=_ONE_, 2=two, 3=three, 4=four} 
   //sampleEnd
}
actual open override fun putAll(from: Map<out K, V>)(source)

Updates this map with key/value pairs from the specified map from.

Since Kotlin

1.1

Samples

import kotlin.test.*
import java.util.*

fun main() { 
   //sampleStart 
   val map = mutableMapOf(1 to "one", 2 to "two")
map.putAll(mapOf(3 to "three", 4 to "four", 1 to "_ONE_"))

println(map) // {1=_ONE_, 2=two, 3=three, 4=four} 
   //sampleEnd
}
actual open override fun putAll(from: Map<out K, V>)(source)

Updates this map with key/value pairs from the specified map from.

Since Kotlin

1.3

Samples

import kotlin.test.*
import java.util.*

fun main() { 
   //sampleStart 
   val map = mutableMapOf(1 to "one", 2 to "two")
map.putAll(mapOf(3 to "three", 4 to "four", 1 to "_ONE_"))

println(map) // {1=_ONE_, 2=two, 3=three, 4=four} 
   //sampleEnd
}
actual open override fun putAll(from: Map<out K, V>)(source)

Updates this map with key/value pairs from the specified map from.

Since Kotlin

1.8

Samples

import kotlin.test.*
import java.util.*

fun main() { 
   //sampleStart 
   val map = mutableMapOf(1 to "one", 2 to "two")
map.putAll(mapOf(3 to "three", 4 to "four", 1 to "_ONE_"))

println(map) // {1=_ONE_, 2=two, 3=three, 4=four} 
   //sampleEnd
}
actual open override fun putAll(from: Map<out K, V>)(source)

Updates this map with key/value pairs from the specified map from.

Since Kotlin

1.8

Samples

import kotlin.test.*
import java.util.*

fun main() { 
   //sampleStart 
   val map = mutableMapOf(1 to "one", 2 to "two")
map.putAll(mapOf(3 to "three", 4 to "four", 1 to "_ONE_"))

println(map) // {1=_ONE_, 2=two, 3=three, 4=four} 
   //sampleEnd
}