scala.RandomAccessSeq

trait Mutable

[source: scala/RandomAccessSeq.scala]

trait Mutable[A]
extends RandomAccessSeq[A]
A random access sequence that supports update (e.g., an array)
Direct Known Subclasses:
Array.ArrayLike, Array.Array0, RandomAccessSeq.MutableProjection, Buffer, ArrayBuffer, RichStringBuilder

Method Summary
override def drop (from : Int) : MutableProjection[A]
Returns this sequence without its n first elements If this sequence has less than n elements, the empty sequence is returned. (non-strict)
override def projection : MutableProjection[A]
returns a projection that can be used to call non-strict filter, map, and flatMap methods that build projections of the collection.
def readOnly : RandomAccessSeq[A]
override def reverse : MutableProjection[A]
A sequence consisting of all elements of this sequence in reverse order.
override def slice (from0 : Int, until0 : Int) : MutableProjection[A]
A sub-sequence starting at index from and ending (non-inclusive) at index until (non-strict)
override def take (until : Int) : MutableProjection[A]
Returns a sequence consisting only over the first n elements of this sequence, or else the whole sequence, if it has less than n elements. (non-strict)
abstract def update (idx : Int, what : A) : Unit
Methods inherited from RandomAccessSeq
elements, patch, ++, toStream, safeIs
Methods inherited from Seq
length (abstract), lengthCompare, size, isEmpty, concat, last, lastOption, first, firstOption, headOption, isDefinedAt, lastIndexOf, map, flatMap, filter, slice, takeWhile, dropWhile, contains, subseq, toArray, toSeq, equalsWith, startsWith, endsWith, indexOf, containsSlice
Methods inherited from Collection
toString, stringPrefix
Methods inherited from Iterable
partition, foreach, forall, exists, find, findIndexOf, indexOf, foldLeft, foldRight, /:, :\, reduceLeft, reduceRight, copyToBuffer, sameElements, toList, mkString, mkString, mkString, addString, addString, copyToArray, hasDefiniteSize
Methods inherited from PartialFunction
orElse, andThen
Methods inherited from Function1
apply (abstract), compose
Methods inherited from AnyRef
getClass, hashCode, equals, clone, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized
Methods inherited from Any
==, !=, isInstanceOf, asInstanceOf
Method Details
abstract def update(idx : Int, what : A) : Unit

Update the element at given index.

Indices start a 0; xs.apply(0) is the first element of mutable sequence xs.

Note the indexing syntax xs(i) = x is a shorthand for xs.update(i, x).

Parameters
i - the index
x - the value to be written at index i
Throws
ArrayIndexOutOfBoundsException - if i < 0 or length <= i

override def projection : MutableProjection[A]
returns a projection that can be used to call non-strict filter, map, and flatMap methods that build projections of the collection.
Overrides
RandomAccessSeq.projection

def readOnly : RandomAccessSeq[A]

override def drop(from : Int) : MutableProjection[A]
Returns this sequence without its n first elements If this sequence has less than n elements, the empty sequence is returned. (non-strict)
Parameters
n - the number of elements to drop
Returns
the new sequence
Overrides
RandomAccessSeq.drop

override def take(until : Int) : MutableProjection[A]
Returns a sequence consisting only over the first n elements of this sequence, or else the whole sequence, if it has less than n elements. (non-strict)
Parameters
n - the number of elements to take
Returns
a possibly projected sequence
Overrides
RandomAccessSeq.take

override def slice(from0 : Int, until0 : Int) : MutableProjection[A]
A sub-sequence starting at index from and ending (non-inclusive) at index until (non-strict)
Parameters
from - The index of the first element of the slice
until - The index of the element following the slice
Throws
IndexOutOfBoundsException - if from < 0 or length < from + len
Overrides
RandomAccessSeq.slice

override def reverse : MutableProjection[A]
A sequence consisting of all elements of this sequence in reverse order.
Overrides
RandomAccessSeq.reverse