asStream

JVM
JRE8
1.2
fun <T> Sequence<T>.asStream(): Stream<T>

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

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

fun main(args: Array<String>) {
//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
}