Skip to content

Instantly share code, notes, and snippets.

@Sciss
Created April 3, 2013 23:17
Show Gist options
  • Select an option

  • Save Sciss/5306362 to your computer and use it in GitHub Desktop.

Select an option

Save Sciss/5306362 to your computer and use it in GitHub Desktop.
import collection.mutable.{SortedSet => MSet}
val s = MSet(10 -> "a", 10 -> "b", 3 -> "c", 3 -> "c", 3 -> "d", 44 -> "a", 0 -> "a")
// -> 0, 3, 3, 10, 10, 44
val t = MSet(10 -> "a", 10 -> "b", 3 -> "c", 3 -> "c", 3 -> "d", 44 -> "a", 0 -> "a")(Ordering.by(_._1))
// -> 0, 3, 10, 44 . in other words, key inequality does _not_ matter, only ordering
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment