Saturday 7 May 2022

Scala Function - concat

Concat create new collection by adding given collections


object MyBlog {
  def main(args: Array[String]): Unit = {
    concatExample()
  }


  def concatExample(): Unit = {
    val input1 = List(1,2,3,4,5)
    val input2 = List(11,12,13,14,15)
    val res = input1 concat(input2)
    println(res) //List(1, 2, 3, 4, 5, 11, 12, 13, 14, 15)
  }
}









No comments:

Post a Comment