clear
Начиная с Kotlin: 1.0
expect open override fun clear()
Удаляет все элементы из этой коллекции.
Примеры
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
}
© 2010–2026 JetBrains s.r.o. and Kotlin Programming Language contributors
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-linked-hash-set/clear.html