July 2018
Intermediate to advanced
242 pages
8h 6m
English
Let's start by analyzing the effects of applying the mapConcurrent() function we implemented at the beginning to transform elements of the (0..10) range of integers. In the lambda block passed to the mapConcurrent function, we are simulating a long-running processing operation suspending the coroutine for one second, using the delay(1000) function and returning a square of the original integer value.
Our code is going to print the following results to the console:
0149162536496481100Total time: 1040 ms
Our implementation of the Iterable.mapConcurrent() extension function takes a functional parameter, transform: suspend (T) -> R, which represents an operation that is going to be applied to each element of the original of the ...
Read now
Unlock full access