Created
September 16, 2015 10:59
-
-
Save Normal/d6d0532522b0f035d73c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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