asStream

Creates a sequential Stream instance that produces elements from the original sequence.

Since Kotlin

1.2

Samples

import java.util.stream.*
import kotlin.streams.*

fun main() { 
   //sampleStart 
   val evenNumbersSequence: Sequence<Int> = generateSequence(2, { it + 2 }).take(5)
val evenNumberStream: Stream<Int> = evenNumbersSequence.asStream()
println(evenNumberStream.toList()) // [2, 4, 6, 8, 10] 
   //sampleEnd
}