toList

JVM
JRE8
1.2
fun <T> Stream<T>.toList(): List<T>

Returns a List containing all elements produced by this stream.

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

fun main(args: Array<String>) {
//sampleStart
val stringStream: Stream<String> = Stream.of("Lion", "Leopard", "Jaguar", "Tiger")
val stringList: List<String> = stringStream.toList()
println(stringList) // [Lion, Leopard, Jaguar, Tiger]
//sampleEnd
}