emptyMap

fun <K, V> emptyMap(): Map<K, V>(source)

Returns an empty read-only map of specified type.

The returned map is serializable (JVM).

Since Kotlin

1.0

Samples

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

fun main() { 
   //sampleStart 
               val map = emptyMap<String, Int>()
            println("map.isEmpty() is ${map.isEmpty()}") // true

            val anotherMap = mapOf<String, Int>()
            // "Empty maps are equal"
println("map == anotherMap is ${map == anotherMap}") // true 
   //sampleEnd
}