asSequence
Creates a Sequence instance that wraps the original array returning its elements when being iterated.
Since Kotlin
1.0Samples
import kotlin.test.*
fun main() {
//sampleStart
val array = arrayOf('a', 'b', 'c')
val sequence = array.asSequence()
println(sequence.joinToString()) // a, b, c
//sampleEnd
}
Creates a Sequence instance that wraps the original collection returning its elements when being iterated.
Since Kotlin
1.0Samples
import kotlin.test.*
fun main() {
//sampleStart
val collection = listOf('a', 'b', 'c')
val sequence = collection.asSequence()
println(sequence.joinToString()) // a, b, c
//sampleEnd
}
Creates a Sequence instance that wraps the original map returning its entries when being iterated.