Skip to content

Instantly share code, notes, and snippets.

@babedev
Created March 25, 2018 09:49
Show Gist options
  • Save babedev/19b0b6175d9786af5962c58e8c43668a to your computer and use it in GitHub Desktop.
Save babedev/19b0b6175d9786af5962c58e8c43668a to your computer and use it in GitHub Desktop.
Sequence operation
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