Reputation: 817
I need to update the elements of an array without creating a new array again
val funcRemoveQuotes=(x:String)=>
{
x.substring(1,x.length-1)
}
probeFileLines.map(x => x._2.toString()).map(x => x.split(","))
.map(//.need to apply funcRemoveQuotes on each element of array)
I want to do it by way without using yield
Upvotes: 0
Views: 688
Reputation: 51271
You can modify an Array
, in place, like so:
arr.indices.foreach(x => arr(x) = funcRemoveQuotes(arr(x)))
Upvotes: 1