Solution: Flow Processing
See the solution to the challenge on flow processing.
We'll cover the following...
Solution
The solution to the challenge we just solved is as follows.
suspend fun main(){ println("Output of Part A") flowOf(1, 3, 5, 9) .map { it * it * it} .collect { println(it) } println("Output of Part B") (1..100).asFlow() .filter { it % 5 == 0 } .filter { is_Odd(it) } .collect { println(it) } println("Output of Part C") ('A'..'Z').asFlow() .drop(15) .collect { print("$it ") } } fun is_Odd(num: Int): Boolean = num % 2 != 0
Complete code of the solution
Here is a line–by–line explanation of the code above: