Skip to content

Instantly share code, notes, and snippets.

@casualjim
Created August 24, 2011 15:58
Show Gist options
  • Select an option

  • Save casualjim/1168386 to your computer and use it in GitHub Desktop.

Select an option

Save casualjim/1168386 to your computer and use it in GitHub Desktop.
object MultiMap {
type Coll = MultiMap
def apply(elems: (String, Seq[String])*): MultiMap = (newBuilder ++= elems).result
def newBuilder: Builder[(String, Seq[String]), MultiMap] = new MapBuilder[String, Seq[String], MultiMap](empty)
implicit def canBuildFrom: CanBuildFrom[Map[String, Seq[String]], (String, Seq[String]), MultiMap] = {
new CanBuildFrom[Map[String, Seq[String]], (String, Seq[String]), MultiMap] {
def apply(from: Map[String, Seq[String]]) = newBuilder
def apply() = newBuilder
}
}
def empty = new MultiMap()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment