# Server Side Kotlin-07

#### Flatten﻿:-

It provides flat access to nested collection elements .  
**flatten** () is a collection of collections, for example, array of array, a List of Sets or List of List. The function returns a single collection of all the elements of the nested collections.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1702733861642/e3be7120-8d6e-4e50-9dcc-66185998f636.png align="center")

````plaintext
val numberSets = listOf(setOf(11, 22, 33), setOf(44, 55, 66), setOf(77,88))
println(numberSets.flatten())   
```   
output:-   
`[11, 22, 33, 44, 55, 66, 77, 88]`    
**joinToString()**  builds a single String from the collection elements based on the provided arguments.   
``` 
val numbers = listOf("blue", "red", "orange", "pink")

println(numbers)         
println(numbers.joinToString())  
```     
output    
`[blue, red, orange, pink]`     
`blue, red, orange, pink`
````
