Skip to content

Instantly share code, notes, and snippets.

@leifwickland
Created May 13, 2011 17:02
Show Gist options
  • Save leifwickland/970895 to your computer and use it in GitHub Desktop.
Save leifwickland/970895 to your computer and use it in GitHub Desktop.
Append to Map of Lists
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