2016-08-25 71 views
0

我需要更新一个数组的元素,而无需创建一个新的数组再次更新数组的元素在斯卡拉

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) 

我想办法做到这一点,而不使用产量

+0

我很好奇,什么样的数据元素,在'probeFileLines',包含引号仅_after_调用'的toString()'就可以了? – jwvh

回答

1

您可以修改一个Array,到位,像这样:

arr.indices.foreach(x => arr(x) = funcRemoveQuotes(arr(x)))