Buffers

An important sub-category of mutable sequences is Buffers. They
allow not only updates of existing elements but also element
insertions, element removals, and efficient additions of new elements
at the end of the buffer. The principal new methods supported by a
buffer are += and ++= for element addition at
the end, +=: and ++=: for addition at the
front, insert and insertAll for element insertions, as well as
remove and -= for element removal. These operations are
summarized in the following table.

Two often used implementations of buffers are
ListBuffer and
ArrayBuffer. As the name implies, a
ListBuffer is backed by a List, and supports efficient
conversion of its elements to a List, whereas an ArrayBuffer is
backed by an array, and can be quickly converted into one.