Created
May 13, 2011 17:02
-
-
Save leifwickland/970895 to your computer and use it in GitHub Desktop.
Append to Map of Lists
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def appendAt[K,V](m: scala.collection.mutable.Map[K,List[V]], k: K, v: V) = m(k) = (m.getOrElse(k, List[V]()) :+ v) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment