List Concatenate

object Concatenate {

  def concat[T](l: List[List[T]]): List[T] = FoldLeft.foldLeft(l, Nil: List[T])(AppendByFoldLeft.append)

  def main(args: Array[String]): Unit = {

    println(concat(List(List(1, 2, 3), List(4, 5, 6), List(7, 8, 9))))

  }

} 
List(1, 2, 3, 4, 5, 6, 7, 8, 9)
原文地址:https://www.cnblogs.com/JonkeyGuan/p/5422663.html