score:2

Accepted answer

as i mentioned in my comment, using either diff or intersect probably won't help you solve your problem. there might be something better built in, but if there is not, then you can use logic similar to this (which is in long form so that the different steps are clear):

val l1 = seq( ("a" , 1) , ("b" , 2) , ("c" , 3) )
val l2 = seq( ("a" , 4) , ("d" , 5) , ("c" , 6) )

val m1 = l1.tomap
val m2 = l2.tomap

val differentkeys = m1.keyset.diff(m2.keyset)  ++ m2.keyset.diff(m1.keyset)
val result = (l1 ++ l2).filter{
  case (k, v) => differentkeys.contains(k)
}
println(result)

Related Query

More Query from same tag