scala

trait RandomAccessSeq

[source: scala/RandomAccessSeq.scala]

trait RandomAccessSeq[+A]
extends Seq[A]
Sequences that support O(1) element access and O(1) length computation.
Author
Sean McDirmid
Direct Known Subclasses:
RandomAccessSeq.Projection, RandomAccessSeq.Mutable, Seq.singleton, PagedSeq, ResizableArray, RichString

Method Summary
override def ++ [B >: A](that : Iterable[B]) : RandomAccessSeq[B]
Appends two iterable objects.
override def drop (from : Int) : RandomAccessSeq[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 elements : Iterator[A]
Creates a new iterator over all elements contained in this object.
def patch [B >: A](from0 : Int, patch0 : RandomAccessSeq[B], replaced0 : Int) : Projection[B]
insert segment patch into this sequence at from replacing replaced elements. The result is a projection.
override def projection : Projection[A]
returns a projection that can be used to call non-strict filter, map, and flatMap methods that build projections of the collection.
override def reverse : Seq[A]
A sequence consisting of all elements of this sequence in reverse order.
final def safeIs (idx : Int, a : Any) : Boolean
will return false if index is out of bounds
override def slice (from0 : Int, until0 : Int) : RandomAccessSeq[A]
A sub-sequence starting at index from and ending (non-inclusive) at index until (non-strict)
override def take (until : Int) : RandomAccessSeq[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)
override def toStream : Stream[A]
Returns a stream containing all of the elements in this iterable object.
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
override def projection : Projection[A]
returns a projection that can be used to call non-strict filter, map, and flatMap methods that build projections of the collection.
Overrides
Seq.projection

override def elements : Iterator[A]
Creates a new iterator over all elements contained in this object.
Returns
the new iterator

override def drop(from : Int) : RandomAccessSeq[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
Seq.drop

override def take(until : Int) : RandomAccessSeq[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
Seq.take

override def slice(from0 : Int, until0 : Int) : RandomAccessSeq[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
Seq.slice

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

def patch[B >: A](from0 : Int, patch0 : RandomAccessSeq[B], replaced0 : Int) : Projection[B]
insert segment patch into this sequence at from replacing replaced elements. The result is a projection.

override def ++[B >: A](that : Iterable[B]) : RandomAccessSeq[B]
Appends two iterable objects.
Overrides
Seq.++

override def toStream : Stream[A]
Returns a stream containing all of the elements in this iterable object.
Notes
consider using projection for lazy behavior.

final def safeIs(idx : Int, a : Any) : Boolean
will return false if index is out of bounds