This page is no longer maintained — Please continue to the home page at www.scala-lang.org

DefaultMap, mapValues

No replies
dcsobral
Joined: 2009-04-23,
User offline. Last seen 38 weeks 5 days ago.
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.

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland