sdk-common / com.tomtom.online.sdk.common.functional.collections / Lists / flatMap

flatMap

static fun <A : Any!, B : Any!> flatMap(@NonNull list: MutableList<A>, @NonNull function: (in A) -> out MutableIterable<B>!): MutableList<B>!

For the given list of values runs the given function on each list value and stores the returned flattened result in a list. Flattening means that instead of a List of Lists we will get only a joined List of values.

Parameters

list - MutableList<A>: list of values that are going the be flat mapped

function - (in A) -> out MutableIterable<B>!: function used for flat mapping

- value type

- result type

Return
MutableList<B>!: list of flat mapped values