如何更换不可改变的数组中的值 scala
我有一个数组
我想替换第二个索引字母 "z", 但我不想改变 doot. 我想创建一个新的数组,因为它似乎是成语 scala.
到目前为止,我只能通过更新来更改数组
提供谎言 scala 这样做?
val doot = Array/"a", "b", "c"/
我想替换第二个索引字母 "z", 但我不想改变 doot. 我想创建一个新的数组,因为它似乎是成语 scala.
到目前为止,我只能通过更新来更改数组
doot.update/1, "z"/ // But now doot is modified directly, not ideal!
提供谎言 scala 这样做?
没有找到相关结果
已邀请:
1 个回复
帅驴
赞同来自: