Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions _overviews/scala-book/collections-maps.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,18 +83,18 @@ Here are some things you can do with a mutable `Map`:
```scala
// add elements with +=
states += ("AZ" -> "Arizona")
states += ("CO" -> "Colorado", "KY" -> "Kentucky")
states ++= Map("CO" -> "Colorado", "KY" -> "Kentucky")

// remove elements with -=
states -= "KY"
states -= ("AZ", "CO")
states --= List("AZ", "CO")

// update elements by reassigning them
states("AK") = "Alaska, The Big State"

// retain elements by supplying a function that operates on
// filter elements by supplying a function that operates on
// the keys and/or values
states.retain((k,v) => k == "AK")
states.filterInPlace((k,v) => k == "AK")
```


Expand Down