scala concatenate list

Concatenating Lists in Scala

To concatenate lists in Scala, you can use the ++ operator or the ::: method. Here's an example:

val list1 = List(1, 2, 3)
val list2 = List(4, 5, 6)

val concatenatedList = list1 ++ list2
// or
val concatenatedList = list1 ::: list2

Both ++ and ::: methods create a new list that contains all the elements from both lists. The ++ operator can concatenate any two sequences, while the ::: method is specific to lists.

I hope this helps!