Scala 2.8 breakOut

The answer is found on the definition of map: def map[B, That](f : (A) => B)(implicit bf : CanBuildFrom[Repr, B, That]) : That Note that it has two parameters. The first is your function and the second is an implicit. If you do not provide that implicit, Scala will choose the most specific one available. … Read more

Scala Iterable[(String, Long)] to SortedMap[String,Long] or TreeMap[String, Long] sorted in decreasing order of value [closed]

You can’t do that. SortedMap sorts by keys, not values. If you want it sorted by value, you gotta use ListMap, and can’t avoid converting to List: ListMap(i.toList.sortBy(-_._2):_*) There isn’t really too much wrong with converting to list, since you are loading the whole thing in memory anyway. This is faster too, than building a … Read more