← Docs
kotlin-stdlib / kotlin.streams / java.util.stream.IntStream / toList

toList

JVM
JRE8
1.2
fun IntStream . toList ( ) : List < Int >
(source)

Returns a List containing all elements produced by this stream.

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

fun main(args: Array<String>) {
//sampleStart
val intStream: IntStream = IntStream.of(10, 20, 30)
val intList: List<Int> = intStream.toList()
println(intList) // [10, 20, 30]
//sampleEnd
}
Stay in touch:
  • Contributing to Kotlin
  • Releases
  • Press Kit
  • Security
  • Blog
  • Issue Tracker
  • Brand assets
  • Careers
Supported and developed by JetBrains .
Kotlin™ is protected under the Kotlin Foundation
and licensed under the Apache 2 license .