scala.collection.mutable

trait ResizableArray

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

trait ResizableArray[A]
extends Seq[A]
This class is used internally to implement data structures that are based on resizable arrays. //todo enrich with more efficient operations
Author
Matthias Zenger, Burak Emir
Version
1.0, 03/05/2004
Direct Known Subclasses:
ArrayBuffer, PriorityQueue

Value Summary
protected var array : Array[A]
protected val initialSize : Int
protected var size0 : Int
Method Summary
def apply (i : Int) : A
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.
override def copyToBuffer [B >: A](dest : Buffer[B]) : Unit
Copy all elements to a buffer
def elements : Iterator[A]
Returns a new iterator over all elements of this resizable array.
protected def ensureSize (n : Int) : Unit
ensure that the internal array has at n cells
def length : Int
Returns the length of this resizable array.
protected def swap (a : Int, b : Int) : Unit
Swap two elements of this array.
Methods inherited from Seq
size, isEmpty, concat, ++, isDefinedAt, lastIndexOf, map, flatMap, filter, take, drop, takeWhile, dropWhile, reverse, contains, slice, subseq, toArray
Methods inherited from Collection
toString, stringPrefix
Methods inherited from Iterable
foreach, forall, exists, find, findIndexOf, indexOf, foldLeft, foldRight, /:, :\, reduceLeft, reduceRight, sameElements, toList, mkString, mkString, addString, addString, projection, hasDefiniteSize
Methods inherited from PartialFunction
orElse, andThen
Methods inherited from Function1
compose
Methods inherited from AnyRef
getClass, hashCode, equals, clone, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized
Methods inherited from Any
==, !=, isInstanceOf, asInstanceOf
Value Details
protected val initialSize : Int

protected var array : Array[A]

protected var size0 : Int

Method Details
def length : Int
Returns the length of this resizable array.
Overrides
Seq.length

def apply(i : Int) : A

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 copyToBuffer[B >: A](dest : Buffer[B]) : Unit
Copy all elements to a buffer
Parameters
The - buffer to which elements are copied

def elements : Iterator[A]
Returns a new iterator over all elements of this resizable array.

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.