I'm new to Scala.
If I have the following List
:
val ls = List("a", "a", "a", "b", "b", "c")
how can I create a Map
that holds an number of appearances for every element in the list?
For example the Map
for the list above should be:
Map("a" -> 3, "b" -> 2, "c" -> 1)