mutableSetOf - Kotlin Programming Language PDF
mutableSetOf - Kotlin Programming Language PDF
Overview
Common JVM JS Native Version 1.3
Getting Started
mutableSetOf
Basics
1.1
Classes and Objects
fun <T> mutableSetOf(): MutableSet<T>
Functions and Lambdas Returns an empty new MutableSet.
Coroutines
val set = mutableSetOf<Int>()
println("set.isEmpty() is ${set.isEmpty()}") // true
Multiplatform Programming
set.add(1)
More Language Constructs set.add(2)
set.add(1)
Core Libraries
println(set) // [1, 2]
Reference
set.isEmpty() is true
Java Interop [1, 2]
Native
Tools
set.remove(3)
set += listOf(4, 5)
println(set) // [1, 2, 4, 5]
[1, 2, 3]
[1, 2, 4, 5]
Target platform: JVM Running on kotlin v. 1.3.61
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/mutable-set-of.html 1/2
13/02/2020 mutableSetOf - Kotlin Programming Language
Contributing to Kotlin
Press kit
Sponsored and developed by
Licensed under the Apache 2 license
Kotlin Trademark is protected under the Kotlin Foundation
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/mutable-set-of.html 2/2