|
Scala Library
|
|
class
ArrayBuffer[A](protected val override initialSize : Int)
extends Buffer[A] with GenericTraversableTemplate[A, ArrayBuffer] with BufferLike[A, ArrayBuffer[A]] with IndexedSeqLike[A, ArrayBuffer[A]] with Builder[A, ArrayBuffer[A]] with ResizableArray[A]Buffer class using an array to
represent the assembled sequence internally. Append, update and random
access take constant time (amortized time). Prepends and removes are
linear in the buffer size.| Additional Constructor Summary | |
def
|
this : ArrayBuffer[A] |
| Values and Variables inherited from ResizableArray | |
| array, size0 |
| Method Summary | |
override def
|
++=
(iter : Traversable[A]) : ArrayBuffer[A]
Appends a number of elements provided by an iterable object
via its
iterator method. The identity of the
buffer is returned. |
override def
|
++=:
(iter : Traversable[A]) : ArrayBuffer[A]
Prepends a number of elements provided by an iterable object
via its
iterator method. The identity of the
buffer is returned. |
def
|
+=
(elem : A) : ArrayBuffer[A]
Appends a single element to this buffer and returns
the identity of the buffer. It takes constant time.
|
def
|
+=:
(elem : A) : ArrayBuffer[A]
Prepends a single element to this buffer and return
the identity of the buffer. It takes time linear in
the buffer size.
|
def
|
clear
: Unit
Clear the contents of this builder
|
override def
|
clone
: ArrayBuffer[A]
Return a clone of this buffer.
|
override def
|
companion
: GenericCompanion[ArrayBuffer]
The factory companion object that builds instances of class CC
|
def
|
insertAll
(n : Int, seq : Traversable[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. |
override def
|
remove
(n : Int, count : Int) : Unit
Removes the element on a given index position. It takes time linear in
the buffer size.
|
def
|
remove
(n : Int) : A
Removes the element on a given index position
|
def
|
result
: ArrayBuffer[A]
Returns collection resulting from this builder. The buffer's contents
are undefined afterwards.
|
override def
|
sizeHint
(len : Int) : Unit
Give a hint how many elements are expected to be added
when the next `result` is called.
|
override def
|
stringPrefix
: java.lang.String
Defines the prefix of the string representation.
|
| Methods inherited from ResizableArray | |
| length, apply, update, foreach, copyToArray, reduceToSize, ensureSize, swap, copy |
| Methods inherited from Builder | |
| mapResult |
| Methods inherited from IndexedSeqLike | |
| thisCollection, toCollection, view, view |
| Methods inherited from IndexedSeqLike | |
| iterator, isEmpty, forall, exists, find, foldLeft, foldRight, reduceLeft, reduceRight, zip, zipWithIndex, slice, head, tail, last, init, take, drop, takeRight, dropRight, splitAt, takeWhile, dropWhile, span, sameElements, lengthCompare, segmentLength, indexWhere, lastIndexWhere, reverse, reverseIterator, startsWith, endsWith |
| Methods inherited from BufferLike | |
| +:, -=, ++:, ++=:, ++:, append, appendAll, prepend, prependAll, prependAll, insert, trimStart, trimEnd, <<, ++=, +, +, ++, ++, -, -, --, --, readOnly |
| Methods inherited from Shrinkable | |
| -=, --=, --= |
| Methods inherited from Growable | |
| +=, ++= |
| Methods inherited from SeqLike | |
| size, isDefinedAt, prefixLength, indexWhere, findIndexOf, indexOf, indexOf, lastIndexOf, lastIndexOf, lastIndexWhere, reverseMap, reversedElements, startsWith, indexOfSeq, indexOfSeq, lastIndexOfSeq, lastIndexOfSeq, contains, union, diff, intersect, removeDuplicates, patch, updated, +:, :+, padTo, sortWith, sortWith, sortBy, toSeq, indices, hashCode, equals, toString, findLastIndexOf, equalsWith, containsSlice, projection |
| Methods inherited from PartialFunction | |
| orElse, andThen |
| Methods inherited from Function1 | |
| compose |
| Methods inherited from IterableLike | |
| elements, toIterable, zipAll, toStream, canEqual, first, firstOption |
| Methods inherited from GenericTraversableTemplate | |
| newBuilder, genericBuilder, unzip, flatten, transpose |
| Methods inherited from TraversableLike | |
| repr, nonEmpty, hasDefiniteSize, ++, ++, map, flatMap, filter, filterNot, partialMap, remove, partition, groupBy, count, /:, :\, reduceLeftOption, reduceRightOption, sum, product, min, max, headOption, lastOption, copyToBuffer, copyToArray, toArray, toList, toIndexedSeq, toSet, mkString, mkString, mkString, addString, addString, addString, withFilter |
| Methods inherited from AnyRef | |
| getClass, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized |
| Methods inherited from Any | |
| ==, !=, isInstanceOf, asInstanceOf |
| Additional Constructor Details |
| Method Details |
override
def
companion : GenericCompanion[ArrayBuffer]
def
clear : Unit
def
+=(elem : A) : ArrayBuffer[A]
elem - the element to append.override
def
++=(iter : Traversable[A]) : ArrayBuffer[A]
iterator method. The identity of the
buffer is returned.iter - the iterfable object.
def
+=:(elem : A) : ArrayBuffer[A]
elem - the element to append.override
def
++=:(iter : Traversable[A]) : ArrayBuffer[A]
iterator method. The identity of the
buffer is returned.iter - the iterable object.
def
insertAll(n : Int, seq : Traversable[A]) : Unit
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.n - the index where a new element will be inserted.iter - the iterable object providing all elements to insert.n is out of bounds.n - the index which refers to the first element to delete.count - the number of elemenets to deleten is out of bounds.n - the index which refers to the element to delete.override
def
clone : ArrayBuffer[A]
ArrayBuffer with the same elements.
def
result : ArrayBuffer[A]
override
def
stringPrefix : java.lang.String
|
Scala Library
|
|