Skip to content

Instantly share code, notes, and snippets.

@Normal
Created September 16, 2015 10:59
Show Gist options
  • Save Normal/d6d0532522b0f035d73c to your computer and use it in GitHub Desktop.
Save Normal/d6d0532522b0f035d73c to your computer and use it in GitHub Desktop.
//id to detect which object was chosen to remain
case class TC(id: Long, value: String) {
override def equals(obj: Any): Boolean = obj match {
case tc: TC => value == tc.value
case _ => false
}
}
val data = List(TC(1, "1"), TC(2, "1"), TC(3, "2"), TC(4, "1"), TC(5, "2"), TC(6, "2"), TC(7, "3"), TC(8, "3"))
data.groupBy(_.value).map(_._2.last)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment