List AppendByFoldLeft

object AppendByFoldLeft {

  def append[T](l: List[T], z: List[T]): List[T] = FoldLeft.foldLeft(Reverse.reverse(l), z)((a: List[T], b: T) => b :: a)

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

    println(append(List("1", "2", "3"), List("4", "5", "6")))

  }

}
List(1, 2, 3, 4, 5, 6)

 

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