emptySet

fun <T> emptySet(): Set<T>(source)

Returns an empty read-only set. The returned set is serializable (JVM).

Since Kotlin

1.0

Samples

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
}