views:

253

answers:

1

How to create sorted map in scala (mutable/immutable)?

+6  A: 

Use a TreeMap.

Aaron Digulla
Indeed. It is immutable, so updates cost log(n) in space (i.e. garbage collector churn) as well as time. But there isn't a mutable implementation, so it's the best solution presently (which is to say, good for most things except very intensive usage).
Rex Kerr