Skip to content

Instantly share code, notes, and snippets.

@alexy
Created January 8, 2012 11:04
Show Gist options
  • Save alexy/1578010 to your computer and use it in GitHub Desktop.
Save alexy/1578010 to your computer and use it in GitHub Desktop.
adding Ordering
case class User(sid: Int, uid: String) extends Ordered[User] {
override def compare(b: User): Int = {
(this.sid compare b.sid) match {
case 0 => this.uid compare b.uid
case x => x
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment