asSequence

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

Creates a Sequence instance that wraps the original stream iterating through its elements.

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

fun main(args: Array<String>) {
//sampleStart
val stringStream: Stream<String> = Stream.of("Never", "gonna", "give", "you", "up")
val stringSequence: Sequence<String> = stringStream.asSequence()
println(stringSequence.joinToString(" ")) // Never gonna give you up
//sampleEnd
}