Matej Cerny's avatar
Matej Cerny 0 months ago
This is how the code above is desuggered (I altered the length of both lists): ``` val as = List(1, 2) val bs = List(3, 4, 5, 6) as.flatMap(a => bs.map(b => a + b)) // result: List(4, 5, 6, 7, 5, 6, 7, 8) ```

Replies (1)

Matej Cerny's avatar
Matej Cerny 0 months ago
So in case the first list has two elements, two lists will be created and then flattened into one.