Add tests for mapping operations
This commit is contained in:
committed by
Yan Zhulanow
parent
5383ec50d2
commit
b31db50ba1
@@ -0,0 +1,7 @@
|
||||
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package map
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
// Breakpoint!
|
||||
doubleArrayOf(1.0, 2.0).asSequence().map { it * it }.contains(3.0)
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package map
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
// Breakpoint!
|
||||
intArrayOf(1, 2, 3, 4).asSequence().mapIndexed { ix, _ -> ix }.count()
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package map
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
// Breakpoint!
|
||||
val lst = listOf(1, 2, null, 3).asSequence().mapNotNull { if (it != null && it % 2 == 1) it else null }.toList()
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package map
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
// Breakpoint!
|
||||
intArrayOf(1, 2, 3).asSequence().withIndex().forEach {}
|
||||
}
|
||||
Reference in New Issue
Block a user