clear

open override fun clear()(source)

Removes all elements from this collection.

Since Kotlin

1.4

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
}