August 2017
Intermediate to advanced
440 pages
10h
English
We've already seen a few stream processing functions, but it needs some skill and creativity to use them for complex use cases. This is why in this section, we are going to discuss some complex stream processing examples.
Let's suppose that we again need to find the best three students who are passing, according to their grade. The key difference is that, in this case, the final order of students must be the same as it was in the beginning. Note that during a sorting by grade operation, this order is lost. But we can preserve it if we keep the value and index together. Thanks to that, we can later sort elements according to this preserved index. Here is how to implement this processing:
data class ...
Read now
Unlock full access