I want to convert a Traversable[T] to a Map[T, Int] histogram with counts. I'd like the result to be an immutable Map that matches what I would get by doing:

```
traversable.groupBy(_).mapValues(_.length)

```

But it looks like this isn't spacewise or timewise efficient...since `groupBy` maintains a reference to every element in the traversable, this has poor performance on large traversables with a small set of unique keys. I really want something more like this:

```
def histogram[T](ts : Traversable[T]) : Map[T, Int] = {
  val map = new collection.mutable.HashMap[T, Int].withDefaultValue(0)
  ts.foreach { map(_) += 1 }
  map.toMap
}

```

Is there a library method that gives me this result (and ideally, works well with the parallel collections)?