Files
kotlin-fork/nj2k/testData/newJ2k/javaStreamsApi/streamOperations.kt
T
Ilya Kirillov f950a0246c New J2K: handle correctly short names which are imported by default in kotlin (like List or Result)
Kotlin default import inserter was unable to correctly insert such imports

#KT-34165 fixed
2019-10-04 15:17:35 +03:00

17 lines
495 B
Kotlin
Vendored

import java.util.Comparator
import java.util.stream.Collectors
internal class Test {
fun main(lst: List<Int>) {
val newLst = lst.stream()
.filter { x: Int -> x > 10 }
.map { x: Int -> x + 2 }
.distinct()
.sorted()
.sorted(Comparator.naturalOrder())
.peek { x: Int? -> println(x) }
.limit(1)
.skip(42)
.collect(Collectors.toList())
}
}