We know that Scala supports immutable data structures..i.e each time u update the list it will create a new object and reference in the heap.
Example
val xs:List[Int] = List.apply(22)
val newList = xs ++ (33)
So when i append the second element to a list it will create a new list which will contain both 22 and 33.This exactly works like how immutable String works in Java. So the question is each time I append a element in the list a new object will be created each time..This ldoes not look efficient to me. is there some special data structures like persistent data structures are used when dealing with this..Does anyone know about this?
ListBuffer).