flatMap 
  Returns a single list of all elements yielded from results of transform function being invoked on each element of original array.
Since Kotlin
1.0Samples
import kotlin.test.*
fun main() { 
   //sampleStart 
   val list = listOf("123", "45")
println(list.flatMap { it.toList() }) // [1, 2, 3, 4, 5] 
   //sampleEnd
}Returns a single list of all elements yielded from results of transform function being invoked on each element of original array.
Since Kotlin
1.4Samples
import kotlin.test.*
fun main() { 
   //sampleStart 
   val list = listOf("123", "45")
println(list.flatMap { it.toList() }) // [1, 2, 3, 4, 5] 
   //sampleEnd
}Returns a single list of all elements yielded from results of transform function being invoked on each element of original collection.
Since Kotlin
1.0Samples
import kotlin.test.*
fun main() { 
   //sampleStart 
   val list = listOf("123", "45")
println(list.flatMap { it.toList() }) // [1, 2, 3, 4, 5] 
   //sampleEnd
}Returns a single list of all elements yielded from results of transform function being invoked on each element of original collection.
Since Kotlin
1.4Samples
import kotlin.test.*
fun main() { 
   //sampleStart 
   val list = listOf("123", "45")
println(list.flatMap { it.toList() }) // [1, 2, 3, 4, 5] 
   //sampleEnd
}Returns a single list of all elements yielded from results of transform function being invoked on each entry of original map.
Since Kotlin
1.0Samples
import kotlin.test.*
import java.util.*
fun main() { 
   //sampleStart 
   val map = mapOf("122" to 2, "3455" to 3)
println(map.flatMap { (key, value) -> key.take(value).toList() }) // [1, 2, 3, 4, 5] 
   //sampleEnd
}Returns a single list of all elements yielded from results of transform function being invoked on each entry of original map.
Since Kotlin
1.4Samples
import kotlin.test.*
fun main() { 
   //sampleStart 
   val list = listOf("123", "45")
println(list.flatMap { it.toList() }) // [1, 2, 3, 4, 5] 
   //sampleEnd
}Returns a single list of all elements yielded from results of transform function being invoked on each element of original array.
Since Kotlin
1.3Samples
import kotlin.test.*
fun main() { 
   //sampleStart 
   val list = listOf("123", "45")
println(list.flatMap { it.toList() }) // [1, 2, 3, 4, 5] 
   //sampleEnd
}