Unable to updating an array inside list's map function. Scala Programming


I am trying to update an Array[Array[String]] type when a map function is called on list.
var m : Array[Array[String]] = Array(Array(""))
var n : List((String, Double)) n contains 100 elements. I want to update m foreach element in n like n.map(x => { m :+ Array(“a”,“b”,“c”); x }) but I am ending up with empty array. Values are not appending to m. I want to try it for an RDD as well. Please help

I am using AccumulatorV2 for this problem.