keys

expect abstract val keys: Set<K>(source)

Returns a read-only Set of all keys in this map.

Since Kotlin

1.0

Samples

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

fun main() { 
   //sampleStart 
   val map = mapOf(1 to "one", 2 to "two")
println(map.keys) // [1, 2] 
   //sampleEnd
}
actual abstract val keys: Set<K>(source)

Returns a read-only Set of all keys in this map.

Since Kotlin

1.1

Samples

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

fun main() { 
   //sampleStart 
   val map = mapOf(1 to "one", 2 to "two")
println(map.keys) // [1, 2] 
   //sampleEnd
}
actual abstract val keys: Set<K>(source)

Returns a read-only Set of all keys in this map.

Since Kotlin

1.0

Samples

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

fun main() { 
   //sampleStart 
   val map = mapOf(1 to "one", 2 to "two")
println(map.keys) // [1, 2] 
   //sampleEnd
}
actual abstract val keys: Set<K>(source)

Returns a read-only Set of all keys in this map.

Since Kotlin

1.3

Samples

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

fun main() { 
   //sampleStart 
   val map = mapOf(1 to "one", 2 to "two")
println(map.keys) // [1, 2] 
   //sampleEnd
}
actual abstract val keys: Set<K>(source)

Returns a read-only Set of all keys in this map.

Since Kotlin

1.8

Samples

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

fun main() { 
   //sampleStart 
   val map = mapOf(1 to "one", 2 to "two")
println(map.keys) // [1, 2] 
   //sampleEnd
}
actual abstract val keys: Set<K>(source)

Returns a read-only Set of all keys in this map.

Since Kotlin

1.8

Samples

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

fun main() { 
   //sampleStart 
   val map = mapOf(1 to "one", 2 to "two")
println(map.keys) // [1, 2] 
   //sampleEnd
}