Core API – Kotlin Programming Language (original) (raw)
clear
Removes all elements from this collection.
Since Kotlin
1.0
Samples
import kotlin.math.*
import kotlin.test.*
fun main() {
//sampleStart
val collection: MutableCollection<Char> = mutableSetOf('a', 'b', 'c')
println(collection) // [a, b, c]
collection.clear()
println(collection) // []
//sampleEnd
}Removes all elements from this collection.
Since Kotlin
1.1
Samples
import kotlin.math.*
import kotlin.test.*
fun main() {
//sampleStart
val collection: MutableCollection<Char> = mutableSetOf('a', 'b', 'c')
println(collection) // [a, b, c]
collection.clear()
println(collection) // []
//sampleEnd
}Removes all elements from this collection.
Since Kotlin
1.0
Samples
import kotlin.math.*
import kotlin.test.*
fun main() {
//sampleStart
val collection: MutableCollection<Char> = mutableSetOf('a', 'b', 'c')
println(collection) // [a, b, c]
collection.clear()
println(collection) // []
//sampleEnd
}Removes all elements from this collection.
Since Kotlin
1.3
Samples
import kotlin.math.*
import kotlin.test.*
fun main() {
//sampleStart
val collection: MutableCollection<Char> = mutableSetOf('a', 'b', 'c')
println(collection) // [a, b, c]
collection.clear()
println(collection) // []
//sampleEnd
}Removes all elements from this collection.
Since Kotlin
1.8
Samples
import kotlin.math.*
import kotlin.test.*
fun main() {
//sampleStart
val collection: MutableCollection<Char> = mutableSetOf('a', 'b', 'c')
println(collection) // [a, b, c]
collection.clear()
println(collection) // []
//sampleEnd
}Removes all elements from this collection.
Since Kotlin
1.8
Samples
import kotlin.math.*
import kotlin.test.*
fun main() {
//sampleStart
val collection: MutableCollection<Char> = mutableSetOf('a', 'b', 'c')
println(collection) // [a, b, c]
collection.clear()
println(collection) // []
//sampleEnd
}