There are two approaches for list concatenation in scala: :::
and ++
.
For instance, there are 3 lists - x, y, z. I heard that x ::: y ::: z
is faster than x ++ y ++ z
, because :::
is right associative. x ::: y ::: z
is parsed as x ::: (y ::: z)
.
My questions are next:
- Is the term above true?
- What is the time complexity both of
:::
and++
.