Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 9abb8c1 + 0e4bce9 commit 2f1a40cCopy full SHA for 2f1a40c
_overviews/scala-book/collections-maps.md
@@ -83,18 +83,18 @@ Here are some things you can do with a mutable `Map`:
83
```scala
84
// add elements with +=
85
states += ("AZ" -> "Arizona")
86
-states += ("CO" -> "Colorado", "KY" -> "Kentucky")
+states ++= Map("CO" -> "Colorado", "KY" -> "Kentucky")
87
88
// remove elements with -=
89
states -= "KY"
90
-states -= ("AZ", "CO")
+states --= List("AZ", "CO")
91
92
// update elements by reassigning them
93
states("AK") = "Alaska, The Big State"
94
95
-// retain elements by supplying a function that operates on
+// filter elements by supplying a function that operates on
96
// the keys and/or values
97
-states.retain((k,v) => k == "AK")
+states.filterInPlace((k,v) => k == "AK")
98
```
99
100
0 commit comments