scala.collection.mutable
trait Buffer

[source: `scala/collection/mutable/Buffer.scala`]

@cloneable
`` `trait` Buffer[A]
  `extends` Seq[A]`with` Scriptable[Message[(Location, A)]]

  Buffers are used to create sequences of elements incrementally by appending, prepending, or inserting new elements. It is also possible to access and modify elements in a random access fashion via the index of the element in the current sequence.

Author
  Matthias Zenger
Version
  1.1, 02/03/2004

Direct Known Subclasses:
  ArrayBuffer, BufferProxy, ListBuffer, ObservableBuffer, SynchronizedBuffer

Method Summary
`def` | + (elem : A) : Buffer[A] Append a single element to this buffer and return the identity of the buffer.
`def` | ++ (iter : Iterable[A]) : Buffer[A] Appends a number of elements provided by an iterable object via its `elements` method. The identity of the buffer is returned.
`def` | ++ (iter : Iterator[A]) : Buffer[A] Appends a number of elements provided by an iterator via its `elements` method. The identity of the buffer is returned.
`def` | ++: (iter : Iterable[A]) : Buffer[A] Prepends a number of elements provided by an iterable object via its `elements` method. The identity of the buffer is returned.
`def` | ++= (src : Array[A], start : Int, len : Int) : Unit Appends a number of elements in an array
`def` | ++= (iter : Iterable[A]) : Unit Appends a number of elements provided by an iterable object via its `elements` method.
`def` | ++= (iter : Iterator[A]) : Unit Appends a number of elements provided by an iterator
`abstract def` | +: (elem : A) : Buffer[A] Prepend a single element to this buffer and return the identity of the buffer.
`abstract def` | += (elem : A) : Unit Append a single element to this buffer.
`def` | -= (x : A) : Unit Removes a single element from this buffer, at its first occurrence. If the list does not contain that element, it is unchanged
`def` | << (cmd : Message[(Location, A)]) : Unit Send a message to this scriptable object.
`def` | append (elems : A*) : Unit Appends a sequence of elements to this buffer.
`def` | appendAll (iter : Iterable[A]) : Unit Appends a number of elements provided by an iterable object via its `elements` method.
`abstract def` | clear : Unit Clears the buffer contents.
`override def` | clone : Buffer[A] Return a clone of this buffer.
`override def` | hashCode : Int The hashCode method always yields an error, since it is not safe to use buffers as keys in hash tables.
`def` | insert (n : Int, elems : A*) : Unit Inserts new elements at the index `n`. Opposed to method `update`, this method will not replace an element with a one. Instead, it will insert the new elements at index `n`.
`abstract def` | insertAll (n : Int, iter : Iterable[A]) : Unit Inserts new elements at the index `n`. Opposed to method `update`, this method will not replace an element with a one. Instead, it will insert a new element at index `n`.
`def` | prepend (elems : A*) : Unit Prepend an element to this list.
`def` | prependAll (iter : Iterable[A]) : Unit Prepends a number of elements provided by an iterable object via its `elements` method. The identity of the buffer is returned.
`abstract def` | remove (n : Int) : A Removes the element on a given index position.
`protected override def` | stringPrefix : String Defines the prefix of the string representation.
`def` | trimEnd (n : Int) : Unit Removes the last `n` elements.
`def` | trimStart (n : Int) : Unit Removes the first `n` elements.
`abstract def` | update (n : Int, newelem : A) : Unit Replace element at index `n` with the new element `newelem`.

Methods inherited from Seq
length (abstract), size, isEmpty, concat, last, ++, isDefinedAt, lastIndexOf, map, flatMap, filter, take, drop, takeWhile, dropWhile, reverse, contains, slice, subseq, toArray, projection

Methods inherited from Collection
toString, equalWith

Methods inherited from Iterable
elements (abstract), foreach, forall, exists, find, findIndexOf, indexOf, foldLeft, foldRight, /:, :\, reduceLeft, reduceRight, copyToBuffer, sameElements, toList, mkString, mkString, addString, addString, copyToArray, hasDefiniteSize

Methods inherited from PartialFunction
orElse, andThen

Methods inherited from Function1
apply (abstract), compose

Methods inherited from AnyRef
getClass, equals, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized

Methods inherited from Any
==, !=, isInstanceOf, asInstanceOf

Method Details

`abstract` `def` +=(elem : A) : Unit

  Append a single element to this buffer.

Parameters
  `elem -` the element to append.

`` `def` +(elem : A) : Buffer[A]

  Append a single element to this buffer and return the identity of the buffer.

Parameters
  `elem -` the element to append.

`abstract` `def` +:(elem : A) : Buffer[A]

  Prepend a single element to this buffer and return the identity of the buffer.

Parameters
  `elem -` the element to append.

`` `def` ++=(iter : Iterator[A]) : Unit

  Appends a number of elements provided by an iterator

Parameters
  `iter -` the iterator.

`` `def` ++=(iter : Iterable[A]) : Unit

  Appends a number of elements provided by an iterable object via its `elements` method.

Parameters
  `iter -` the iterable object.

`` `def` ++=(src : Array[A], start : Int, len : Int) : Unit

  Appends a number of elements in an array

Parameters
  `src -` the array
  `start -` the first element to append
  `len -` the number of elements to append

`` `def` ++(iter : Iterable[A]) : Buffer[A]

  Appends a number of elements provided by an iterable object via its `elements` method. The identity of the buffer is returned.

Parameters
  `iter -` the iterable object.
Returns
  the updated buffer.

`` `def` ++(iter : Iterator[A]) : Buffer[A]

  Appends a number of elements provided by an iterator via its `elements` method. The identity of the buffer is returned.

Parameters
  `iter -` the iterator
Returns
  the updated buffer.

`` `def` ++:(iter : Iterable[A]) : Buffer[A]

  Prepends a number of elements provided by an iterable object via its `elements` method. The identity of the buffer is returned.

Parameters
  `iter -` the iterable object.

`` `def` -=(x : A) : Unit

  Removes a single element from this buffer, at its first occurrence. If the list does not contain that element, it is unchanged

Parameters
  `x -` the element to remove.

`` `def` append(elems : A*) : Unit

  Appends a sequence of elements to this buffer.

Parameters
  `elems -` the elements to append.

`` `def` appendAll(iter : Iterable[A]) : Unit

  Appends a number of elements provided by an iterable object via its `elements` method.

Parameters
  `iter -` the iterable object.

`` `def` prepend(elems : A*) : Unit

  Prepend an element to this list.

Parameters
  `elem -` the element to prepend.

`` `def` prependAll(iter : Iterable[A]) : Unit

  Prepends a number of elements provided by an iterable object via its `elements` method. The identity of the buffer is returned.

Parameters
  `iter -` the iterable object.

`` `def` insert(n : Int, elems : A*) : Unit

  Inserts new elements at the index `n`. Opposed to method `update`, this method will not replace an element with a one. Instead, it will insert the new elements at index `n`.

Parameters
  `n -` the index where a new element will be inserted.
  `elems -` the new elements to insert.

`abstract` `def` insertAll(n : Int, iter : Iterable[A]) : Unit

  Inserts new elements at the index `n`. Opposed to method `update`, this method will not replace an element with a one. Instead, it will insert a new element at index `n`.

Parameters
  `n -` the index where a new element will be inserted.
  `iter -` the iterable object providing all elements to insert.

`abstract` `def` update(n : Int, newelem : A) : Unit

  Replace element at index `n` with the new element `newelem`.

Parameters
  `n -` the index of the element to replace.
  `newelem -` the new element.

`abstract` `def` remove(n : Int) : A

  Removes the element on a given index position.

Parameters
  `n -` the index which refers to the element to delete.

`` `def` trimStart(n : Int) : Unit

  Removes the first `n` elements.

Parameters
  `n -` the number of elements to remove from the beginning of this buffer.

`` `def` trimEnd(n : Int) : Unit

  Removes the last `n` elements.

Parameters
  `n -` the number of elements to remove from the end of this buffer.

`abstract` `def` clear : Unit

  Clears the buffer contents.

`` `def` <<(cmd : Message[(Location, A)]) : Unit

  Send a message to this scriptable object.

Parameters
  `cmd -` the message to send.

Overrides
  Scriptable.<<

`override` `def` clone : Buffer[A]

  Return a clone of this buffer.

Returns
  a buffer with the same elements.

`override` `def` hashCode : Int

  The hashCode method always yields an error, since it is not safe to use buffers as keys in hash tables.

Returns
  never.

`protected override` `def` stringPrefix : String

  Defines the prefix of the string representation.