Created
May 4, 2021 10:42
-
-
Save CheolhoJeon/841167c2133c6e6c1a570baf787e1e0d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package chap4.Sequences | |
import atomictest.eq | |
fun main() { | |
val list = listOf(1, 2, 3, 4) | |
list.filter { it % 2 == 0 } | |
.map { it * it } | |
.any { it < 10 } eq true | |
// Equivalent to: | |
val mid1 = list.filter { it % 2 == 0 } | |
mid1 eq listOf(2, 4) | |
val mid2 = mid1.map { it * it } | |
mid2 eq listOf(4, 16) | |
mid2.any { it < 10 } eq true | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment