title: Remove both the object if found duplicate in scala
body: <p>I have an Seq with the following Object</p>
  <p>case class Foo (age: Int, name: String)</p>
  <p>val x = List(Foo(30,&quot;X&quot;), Foo(30,&quot;Y&quot;),Foo(40,&quot;Z&quot;),Foo(50,&quot;X&quot;))</p>
  <p>I want to check the list for duplicates and remove them from the list. In this case my list will only have one values, and in this example it would be the values Foo(40,&quot;Z&quot;), and the three Foo(30,&quot;X&quot;) ,Foo(30,&quot;Y&quot;) and Foo(50,&quot;X&quot;) will go away.</p>
  <p>Because X and 3O is repeated in some object</p>
  <p>What will be the best way to this?</p>