Created
March 25, 2018 09:49
-
-
Save babedev/19b0b6175d9786af5962c58e8c43668a to your computer and use it in GitHub Desktop.
Sequence operation
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
println("List ====> ") | |
listOf(1, 2, 3) | |
.filter { println("Filter: $it"); it % 2 == 0 } | |
.map { println("Map: $it"); it + 1 } | |
.forEach { println("Each: $it") } | |
println("Sequence ====> ") | |
sequenceOf(1, 2, 3) | |
.filter { println("Filter: $it"); it % 2 == 0 } | |
.map { println("Map: $it"); it + 1 } | |
.forEach { println("Each: $it") } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment