- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
DefaultMap, mapValues
Sat, 2009-11-14, 03:09
I was trying to use mapValues when I stumbled upon a small problem. This method returns a DefaultMap class, which extends scala.collection.Map. Unfortunately, methods declaring "Map" as the parameter type can't use a DefaultMap, as "Map" defaults to an immutable map.
While it is a small thing and easy to fix in my code, that it happened at all was unexpected. Is there a reason why I didn't get a map of the same class back? I hope few map methods do the same thing.
--
Daniel C. Sobral
Veni, vidi, veterni.
While it is a small thing and easy to fix in my code, that it happened at all was unexpected. Is there a reason why I didn't get a map of the same class back? I hope few map methods do the same thing.
--
Daniel C. Sobral
Veni, vidi, veterni.