val xs = List(List(4, List(4, 7)), List(3, List(3, 5)), List(4, List(5, 9))
如何将其转换为:
List(List(4, 4, 7), List(3, 3, 5), List(4, 5, 9))
答案 0 :(得分:0)
这样的东西?
xs.map(arr => arr.foldLeft(List[Any]())((acc, value) => value match {
case xs:List[Any] => acc ++ xs
case x:Any => acc :+ x
}))