flatMap

inline fun <R> CharSequence.flatMap(transform: (Char) -> Iterable<R>): List<R>

Returns a single list of all elements yielded from results of transform function being invoked on each character of original char sequence.

Samples

import samples.*
import kotlin.test.*
fun main() { 
   //sampleStart 
   val list = listOf("123", "45")
assertPrints(list.flatMap { it.toList() }, "[1, 2, 3, 4, 5]") 
   //sampleEnd
}