我需要更新数组的元素而不再创建新数组
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)
我希望不使用yield
来实现答案 0 :(得分:1)
您可以就地修改Array
,如下所示:
arr.indices.foreach(x => arr(x) = funcRemoveQuotes(arr(x)))