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)

 

posted on 2016-04-22 20:27  JonkeyGuan  阅读(298)  评论(0编辑  收藏  举报