scala.collection.mutable

trait ResizableArray

[source: scala/collection/mutable/ResizableArray.scala]

trait ResizableArray[A]
extends Vector[A] with TraversableClass[A, ResizableArray] with VectorTemplate[A, ResizableArray[A]]
This class is used internally to implement data structures that are based on resizable arrays.
Author
Matthias Zenger, Burak Emir
Martin Odersky
Version
2.8
Direct Known Subclasses:
ArrayBuffer, PriorityQueue

Value Summary
protected var array : Array[AnyRef]
protected var size0 : Int
Method Summary
def apply (idx : Int) : A
Returns the elements at position `idx`
override def companion : Companion[ResizableArray]
The factory companion object that builds instances of class CC
protected def copy (m : Int, n : Int, len : Int) : Unit
Move parts of the array.
override def copyToArray [B >: A](xs : Array[B], start : Int) : Unit
Fills the given array xs with the elements of this sequence starting at position start.
protected def ensureSize (n : Int) : Unit
ensure that the internal array has at n cells
override def foreach [U](f : (A) => U) : Unit
Copy all elements to a buffer
protected def initialSize : Int
def length : Int
Returns the length of this resizable array.
def reduceToSize (sz : Int) : Unit
remove elements of this array at indices after sz
protected def swap (a : Int, b : Int) : Unit
Swap two elements of this array.
def update (idx : Int, elem : A) : Unit
Methods inherited from MutableVectorTemplate
view, view
Methods inherited from VectorTemplate
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, copyToArray, lengthCompare, segmentLength, indexWhere, lastIndexWhere, reverse, reverseIterator, startsWith, endsWith, equals
Methods inherited from Unhashable
hashCode, identityHashCode
Methods inherited from SequenceTemplate
size, isDefinedAt, zipAll, prefixLength, indexWhere, findIndexOf, indexOf, indexOf, lastIndexOf, lastIndexOf, lastIndexWhere, reversedElements, startsWith, indexOfSeq, indexOfSeq, lastIndexOfSeq, lastIndexOfSeq, contains, union, diff, intersect, removeDuplicates, patch, padTo, toSequence, indices, toString, sortWith, findLastIndexOf, slice, equalsWith, containsSlice, projection
Methods inherited from PartialFunction
orElse, andThen
Methods inherited from Function1
compose
Methods inherited from IterableTemplate
elements, toIterable, toStream, first, firstOption, toSeq
Methods inherited from TraversableClass
newBuilder, genericBuilder, unzip, flatten, transpose
Methods inherited from TraversableTemplate
thisCollection, nonEmpty, hasDefiniteSize, ++, ++, map, flatMap, filter, filterMap, filterNot, remove, partition, groupBy, count, /:, :\, reduceLeftOption, reduceRightOption, headOption, lastOption, copyToBuffer, toArray, toList, toSet, mkString, mkString, mkString, addString, addString, addString, stringPrefix
Methods inherited from AnyRef
getClass, clone, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized
Methods inherited from Any
==, !=, isInstanceOf, asInstanceOf
Value Details
protected var array : Array[AnyRef]

protected var size0 : Int

Method Details
override def companion : Companion[ResizableArray]
The factory companion object that builds instances of class CC
Overrides
Vector.companion, TraversableClass.companion

protected def initialSize : Int

def length : Int
Returns the length of this resizable array.

def apply(idx : Int) : A
Returns the elements at position `idx`

def update(idx : Int, elem : A) : Unit

override def copyToArray[B >: A](xs : Array[B], start : Int) : Unit
Fills the given array xs with the elements of this sequence starting at position start.
Parameters
xs - the array to fill.
start - starting index.

override def foreach[U](f : (A) => U) : Unit
Copy all elements to a buffer
Parameters
The - buffer to which elements are copied override def copyToBuffer[B >: A](dest: Buffer[B]) { dest ++= (array: Sequence[AnyRef]).asInstanceOf[Sequence[B]] }
Overrides
TraversableClass.foreach, VectorTemplate.foreach

def reduceToSize(sz : Int) : Unit
remove elements of this array at indices after sz

protected def ensureSize(n : Int) : Unit
ensure that the internal array has at n cells

protected def swap(a : Int, b : Int) : Unit
Swap two elements of this array.

protected def copy(m : Int, n : Int, len : Int) : Unit
Move parts of the array.