January 2018
Intermediate to advanced
434 pages
14h 1m
English
Let's take a look at the implementation of the flatten() function:
public fun <T> Iterable<Iterable<T>>.flatten(): List<T> { val result = ArrayList<T>() for (element in this) { result.addAll(element) } return result}
As you can see, it's just adding the items from iterables (array or lists) in a new list and returning that list.
Read now
Unlock full access