Created
July 9, 2020 22:27
-
-
Save toantran-ea/7e84b338a11de47c952617beca28deb3 to your computer and use it in GitHub Desktop.
sequence 1
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
fun main(args: Array<String>) { | |
val seq = sequenceOf("a", "ba", "cda", "def") | |
val filter1 = seq.filter { | |
it.length > 1 | |
} | |
println(filter1) // kotlin.sequences.FilteringSequence@28a418fc | |
val filter2 = filter1.filter { | |
it.length > 2 | |
} | |
println(filter2) // kotlin.sequences.FilteringSequence@5305068a | |
val end = filter2.toList(); // terminal | |
println(end) // [cda, def] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment