in scala/collection/mutable
trait Buffer

trait Buffer[A]()
extends Object
with ScalaObject
with Seq[A]
with Scriptable[Message[Tuple2[Location,A]]]
with Cloneable
Implementing classes or objects:
class BufferProxy[A](buf: Buffer[A])
class ListBuffer[A]()
class ArrayBuffer[A]()
trait SynchronizedBuffer[A]()
class ObservableBuffer[A,This <: ObservableBuffer[A,This]]()

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

Method Summary
abstract def +(elem: A): Buffer[A]
     Append a single element to this buffer and return the identity of the buffer.
  def ++(elems: Iterable[A]): Buffer[A]
     Appends a number of elements provided by an iterable object via its elements method.
  def ++(iter: Iterator[A]): Buffer[A]
     Appends a number of elements provided by an iterable object via its elements method.
  def ++:(iter: Iterable[A]): Buffer[A]
     Prepends a number of elements provided by an iterable object via its elements method.
  def ++=(elems: Iterable[A]): Unit
     Appends a number of elements provided by an iterable object via its elements method.
  def ++=(it: Iterator[A]): Unit
     Appends a number of elements provided by an iterable object via its elements method.
abstract def +:(elem: A): Buffer[A]
     Prepend a single element to this buffer and return the identity of the buffer.
  def +=(elem: A): Unit
     Append a single element to this buffer.
  def <<(cmd: Message[Tuple2[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.
abstract def insertAll(n: Int, iter: Iterable[A]): Unit
     Inserts new elements at the index n.
  def prepend(elems: A*): Unit
     Prepend an element to this list.
  def prependAll(elems: Iterable[A]): Unit
     Prepends a number of elements provided by an iterable object via its elements method.
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 java/lang/Object-class
eq, equals, finalize, getClass, notify, notifyAll, synchronized, wait, wait, wait

Methods inherited from scala/Any-class
!=, ==, asInstanceOf, isInstanceOf, match

Methods inherited from scala/Function1-class
apply

Methods inherited from scala/Iterable-class
/:, :\, elements, exists, find, foldLeft, foldRight, forall, foreach, sameElements

Methods inherited from scala/Seq-class
copyToArray, drop, indexOf, isDefinedAt, lastIndexOf, length, subseq, take, toList, toString

Method Detail

+

  abstract 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.

+=

  def +=(elem: A): Unit
Append a single element to this buffer.
Parameters:
elem - the element to append.

++

  def ++(elems: 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.

++

  def ++(iter: Iterator[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.

++=

  def ++=(elems: Iterable[A]): Unit
Appends a number of elements provided by an iterable object via its elements method.
Parameters:
iter - the iterable object.

++=

  def ++=(it: Iterator[A]): Unit
Appends a number of elements provided by an iterable object via its elements method.
Parameters:
iter - the iterable object.

append

  def append(elems: A*): Unit
Appends a sequence of elements to this buffer.
Parameters:
elems - the elements to append.

appendAll

  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.

+:

  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: 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.

prepend

  def prepend(elems: A*): Unit
Prepend an element to this list.
Parameters:
elem - the element to prepend.

prependAll

  def prependAll(elems: 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.

insert

  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.

insertAll

  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.

update

  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.

remove

  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.

trimStart

  def trimStart(n: Int): Unit
Removes the first n elements.
Parameters:
n - the number of elements to remove from the beginning of this buffer.

trimEnd

  def trimEnd(n: Int): Unit
Removes the last n elements.
Parameters:
n - the number of elements to remove from the end of this buffer.

clear

  abstract def clear: Unit
Clears the buffer contents.

<<

  def <<(cmd: Message[Tuple2[Location,A]]): Unit
Send a message to this scriptable object.
Parameters:
cmd - the message to send.

clone

  override def clone(): Buffer[A]
Return a clone of this buffer.
Returns:
a buffer with the same elements.

hashCode

  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.

stringPrefix

  protected override def stringPrefix: String
Defines the prefix of the string representation.