scala.collection.mutable
class ArrayBuffer

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

@serializable
`` `class` ArrayBuffer[A]
  `extends` Buffer[A]`with` ResizableArray[A]

  An implementation of the `Buffer` class using an array to represent the assembled sequence internally.

Author
  Matthias Zenger
Version
  1.0, 15/03/2004

Direct Known Subclasses:
  Script, NodeBuffer

Values and Variables inherited from ResizableArray
initialSize, array

Method Summary
`override 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.
`override def` | ++= (iter : Iterable[A]) : Unit Appends a number of elements provided by an iterable object via its `elements` method. The identity of the buffer is returned.
`override def` | ++= (src : Array[A], start : Int, len : Int) : Unit Appends a number of elements in an array
`def` | +: (elem : A) : Buffer[A] Prepends a single element to this buffer and return the identity of the buffer.
`def` | += (elem : A) : Unit Appends a single element to this buffer and returns the identity of the buffer.
`override def` | apply (i : Int) : A Returns the i-th element of this ArrayBuffer.
`def` | clear : Unit Clears the buffer contents.
`override def` | clone : Buffer[A] Return a clone of this buffer.
`override def` | equals (obj : Any) : Boolean Checks if two buffers are structurally identical.
`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` | 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` | update (n : Int, newelem : A) : Unit Replace element at index `n` with the new element `newelem`.

Methods inherited from ResizableArray
size0, size0_=, length, reduceToSize, copyToArray, copyToBuffer, elements, ensureSize, swap, copy

Methods inherited from RandomAccessSeq
projection, +++

Methods inherited from Buffer
+, ++=, ++, ++, -=, append, appendAll, prepend, prependAll, insert, trimStart, trimEnd, <<, hashCode

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

Methods inherited from Collection
toString, equalWith

Methods inherited from Iterable
foreach, forall, exists, find, findIndexOf, indexOf, foldLeft, foldRight, /:, :\, reduceLeft, reduceRight, sameElements, toList, mkString, mkString, addString, addString, hasDefiniteSize

Methods inherited from PartialFunction
orElse, andThen

Methods inherited from Function1
compose

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

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

Method Details

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

  Appends a single element to this buffer and returns the identity of the buffer.

Parameters
  `elem -` the element to append.

Overrides
  Buffer.+=

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

  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.

Overrides
  Buffer.++=

`override` `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

Overrides
  Buffer.++=

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

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

Parameters
  `elem -` the element to append.
Returns
  the updated buffer.

Overrides
  Buffer.+:

`override` `def` apply(i : Int) : A

  Returns the i-th element of this ArrayBuffer.

Parameters
  `i -` the specified index.
Returns
  the i-th element.
Throws
  `Predef.IndexOutOfBoundException -` if `i` is out of bounds.

Overrides
  ResizableArray.apply

`override` `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.
Returns
  the updated buffer.

Overrides
  Buffer.++:

`` `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.
Throws
  Predef.IndexOutOfBoundsException - if `n` is out of bounds.

Overrides
  Buffer.insertAll

`` `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.
Throws
  Predef.IndexOutOfBoundsException - if `n` is out of bounds.

Overrides
  Buffer.update

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

  Removes the element on a given index position.

Parameters
  `n -` the index which refers to the element to delete.
Returns
  the updated array buffer.
Throws
  Predef.IndexOutOfBoundsException - if `n` is out of bounds.

Overrides
  Buffer.remove

`` `def` clear : Unit

  Clears the buffer contents.

Overrides
  Buffer.clear

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

  Return a clone of this buffer.

Returns
  an `ArrayBuffer` with the same elements.

Overrides
  Buffer.clone

`override` `def` equals(obj : Any) : Boolean

  Checks if two buffers are structurally identical.

Returns
  true, iff both buffers contain the same sequence of elements.

`protected override` `def` stringPrefix : String

  Defines the prefix of the string representation.

Overrides
  Buffer.stringPrefix