4 ms·
Not the same but immutable approach is more idiomatic Scala. List("hi", "there", "hi") .zipWithIndex .map { case (x, i) => x -> i
by virtualwhys 8y ago
Not the same but immutable approach is more idiomatic Scala.
List("hi", "there", "hi")
.zipWithIndex
.map { case (x, i) =>
x -> i
}.toMap
- mruts 8y agoThat example doesn’t really illustrate the point of updating maps with repeated values.