scala.collection.mutable

trait ResizableArray

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

trait ResizableArray[A]
extends RandomAccessSeq[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[AnyRef]
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
override 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 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 size0 : Int
protected def size0_= (sz : Int) : Unit
protected def swap (a : Int, b : Int) : Unit
Swap two elements of this array.
Methods inherited from RandomAccessSeq
projection, drop, take, slice, reverse, partition, patch, ++, toStream, safeIs
Methods inherited from Seq
lengthCompare, size, isEmpty, concat, last, lastOption, first, firstOption, headOption, isDefinedAt, lastIndexOf, findIndexOf, indexOf, map, flatMap, filter, slice, takeWhile, dropWhile, contains, subseq, toArray, toSeq, equalsWith, startsWith, startsWith, endsWith, indexOf, containsSlice
Methods inherited from Collection
toString, stringPrefix
Methods inherited from Iterable
foreach, forall, exists, find, foldLeft, foldRight, /:, :\, reduceLeft, reduceRight, sameElements, toList, mkString, mkString, mkString, addString, addString, addString, 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 var array : Array[AnyRef]

Method Details
protected def initialSize : Int

protected def size0 : Int

protected def size0_=(sz : Int) : Unit

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

def apply(i : Int) : A

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

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

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

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.