Returns an empty new MutableSet.
The returned set preserves the element iteration order.
Since Kotlin
1.1Samples
import kotlin.test.*
fun main() {
val set = mutableSetOf<Int>()
println("set.isEmpty() is ${set.isEmpty()}")
set.add(1)
set.add(2)
set.add(1)
println(set)
}
Target: JVMRunning on v.2.1.20
Returns a new MutableSet with the given elements. Elements of the set are iterated in the order they were specified.
Since Kotlin
1.0Samples
import kotlin.test.*
fun main() {
val set = mutableSetOf(1, 2, 3)
println(set)
set.remove(3)
set += listOf(4, 5)
println(set)
}
Target: JVMRunning on v.2.1.20