If I have
List((1,2),(1,3),(1,4))
and want to convert it to
List((1,List(2,3,4))
I do
val list = List((1, 2), (1, 3), (1, 4))
val groups = list groupBy { case (a, b) => a }
val tups = groups map { case ((a), list) => (a, list.map(_._2)) }
tups.toList
which works but trying to see if there is any other (better) way?