Scala Library Documentation


scala/Seq.scala
]
trait
Seq[+A]
extends
PartialFunction[Int, A] with
Collection[A]Seq[A]
represents finite sequences of elements
of type A
.Method Summary  
override def

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

override def

concat
[B >: A](that : Iterable[B]) : Seq[B]
Appends two iterable objects.

def

contains
(elem : Any) : Boolean
Tests if the given value
elem is a member of this
sequence. 
override def

drop
(n : Int) : Seq[A]
Returns this sequence without its
n first elements
If this sequence has less than n elements, the empty
sequence is returned. 
override def

dropWhile
(p : (A) => Boolean) : Seq[A]
Returns the longest suffix of this sequence whose first element
does not satisfy the predicate
p . 
override def

filter
(p : (A) => Boolean) : Seq[A]
Returns all the elements of this sequence that satisfy the
predicate
p . The order of the elements is preserved. 
override def

flatMap
[B](f : (A) => Iterable[B]) : Seq[B]
Applies the given function
f to each element of
this sequence, then concatenates the results. 
def

isDefinedAt
(x : Int) : Boolean
Is this partial function defined for the index
x ? 
override def

isEmpty
: Boolean
Returns true if length == 0

def

lastIndexOf
[B >: A](elem : B) : Int
Returns the index of the last occurence of the specified element
in this sequence, or 1 if the sequence does not contain this element.

abstract def

length
: Int
Returns the length of the sequence.

override def

map
[B](f : (A) => B) : Seq[B]
Returns the sequence resulting from applying the given function
f to each element of this sequence. 
def

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

def

size
: Int
should always be
length 
def

slice
(from : Int, len : Int) : Seq[A]
Returns a subsequence starting from index
from
consisting of len elements. 
def

subseq
(from : Int, end : Int) : Seq[A]
Returns a subsequence starting from index
from
consisting of len elements. 
override def

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

takeWhile
(p : (A) => Boolean) : Seq[A]
Returns the longest prefix of this sequence whose elements satisfy
the predicate
p . 
override def

toArray
[B >: A] : Array[B]
Converts this sequence to a fresh Array with
length elements. 
Methods inherited from Collection  
toString, stringPrefix 
Methods inherited from Iterable  
elements (abstract), foreach, forall, exists, find, findIndexOf, indexOf, foldLeft, foldRight, /:, :\, reduceLeft, reduceRight, copyToBuffer, sameElements, toList, mkString, mkString, addString, addString, copyToArray, projection, 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
length : Int
def
size : Int
length
override
def
isEmpty : Boolean
++
insteadthat 
..x
?x 
..true
, iff x
is a legal sequence index.elem 
element to search for.f
to each element of this sequence.f 
function to apply to each element.f(a_{0}), ..., f(a_{n})
if this sequence is a_{0}, ..., a_{n}
.f
to each element of
this sequence, then concatenates the results.f 
the function to apply on each element.f(a_{0}) ::: ... ::: f(a_{n})
if this sequence is a_{0}, ..., a_{n}
.p
. The order of the elements is preserved.p 
the predicate used to filter the list.p
.n
elements of this sequence, or else the whole sequence, if it has less
than n
elements.n 
the number of elements to taken
first elements
If this sequence has less than n
elements, the empty
sequence is returned.n 
the number of elements to dropp
.p 
the test predicate.p
.p
.p 
the test predicate.p
.elem
is a member of this
sequence.elem 
element whose membership has to be tested.true
iff there is an element of this sequence which is equal (w.r.t. ==
) to elem
.from
consisting of len
elements.from 
..len 
..
def
subseq(from : Int, end : Int) : Seq[A]
from
consisting of len
elements.slice
insteadlength
elements.
Scala Library Documentation

