empty
Thanks for your feedback!
Was this page helpful?
Returns an empty read-only set. The returned set is serializable (JVM).
import kotlin.test.* fun main() { //sampleStart val set = setOf<String>() println("set.isEmpty() is ${set.isEmpty()}") // true // another way to create an empty set, // type parameter is inferred from the expected type val other: Set<Int> = emptySet() // "Empty sets are equal" println("set == other is ${set == other}") // true println(set) // [] //sampleEnd }
xxxxxxxxxx
val set = setOf<String>()
println("set.isEmpty() is ${set.isEmpty()}") // true
// another way to create an empty set,
// type parameter is inferred from the expected type
val other: Set<Int> = emptySet()
// "Empty sets are equal"
println("set == other is ${set == other}") // true
println(set) // []
Thanks for your feedback!