Closed
Description
2.12:
scala> res0.mapValues(x=> x^2)
res7: scala.collection.immutable.Map[String,Int] = Map(32 -> 1)
2.13:
scala> res0.mapValues(x=> x^2).toMap
^
warning: method mapValues in trait MapOps is deprecated (since 2.13.0): Use .view.mapValues(f). A future version will include a strict version of this method (for now, .view.mapValues(f).toMap).
res9: scala.collection.immutable.Map[String,Int] = Map(32 -> 1)
The recommended replacement does not compile in 2.12:
scala> Map(1 -> 2).view.mapValues(x => x*x)
<console>:12: error: value mapValues is not a member of scala.collection.IterableView[(Int, Int),scala.collection.immutable.Map[Int,Int]]
Map(1 -> 2).view.mapValues(x => x*x)
^
This could be remedied by adding an extension method for map-like IterableView
s.
Metadata
Metadata
Assignees
Labels
No labels