So I have an array of array of ints, for example
val n = Array(Array(1,2,3), Array(4,5,6), Array(7,8,9))
But I want to convert this to get
Array(1,2,3,4,5,6,7,8,9)
Is that even possible and how? Thanks!
In addition to mushroom's answer:
If it is you who is producing such 2D array (as opposed to getting it from an external source), you might make use of a .flatMap function instead of two nested .maps.
flatten can be written as a flatMap(identity).