小编Dwi*_*Aji的帖子

Scala 中的 MapView(<未计算>)

我开始学习 Scala,但发现了一个令人困惑的问题map。我的代码是这样的:

val mymap = Map(1 -> "james",2 -> "justin")
println(mymap.view.mapValues(x => "hi" + x))
println(mymap.view.mapValues(x => x.toUpperCase))
Run Code Online (Sandbox Code Playgroud)

但结果是

MapView(<not computed>)
MapView(<not computed>)
Run Code Online (Sandbox Code Playgroud)

我正在使用,view.mapValues因为.map已弃用。我需要阅读有关此内容的任何建议或文档吗?

dictionary scala

4
推荐指数
1
解决办法
834
查看次数

标签 统计

dictionary ×1

scala ×1