Scala Library
|
|
trait
TraversableViewTemplate[+A, +Coll <: Traversable[Any], +This <: TraversableView[A, Coll] with
TraversableViewTemplate[A, Coll, This]]
extends
Traversable[A] with
TraversableTemplate[A, This]
A base class for views of Traversable
.
Every subclass has to implement the foreach
method.
Method Summary | |
override def
|
++
[B >: A, That](that : Iterator[B])(implicit bf : BuilderFactory[B, That, This]) : That
Creates a new traversable of type `That` which contains all elements of this traversable
followed by all elements of an iterator.
|
override def
|
++
[B >: A, That](that : Traversable[B])(implicit bf : BuilderFactory[B, That, This]) : That
Creates a new traversable of type `That` which contains all elements of this traversable
followed by all elements of another traversable.
|
override def
|
drop
(n : Int) : This
Returns this traversable without its
n first elements
If this traversable has less than n elements, the empty
traversable is returned. |
override def
|
dropWhile
(p : (A) => Boolean) : This
Returns the longest suffix of this traversable whose first element
does not satisfy the predicate
p . |
override def
|
filter
(p : (A) => Boolean) : This
Returns all the elements of this traversable that satisfy the
predicate
p . The order of the elements is preserved. |
override def
|
flatMap
[B, That](f : (A) => Traversable[B])(implicit bf : BuilderFactory[B, That, This]) : That
Applies the given function
f to each element of
this traversable, then concatenates the results in an traversable of type That. |
def
|
force
[B >: A, That](implicit bf : BuilderFactory[B, That, Coll]) : That
|
override def
|
init
: This
An traversable consisting of all elements of this traversable except the last one.
|
override def
|
map
[B, That](f : (A) => B)(implicit bf : BuilderFactory[B, That, This]) : That
Returns the traversable that results from applying the given function
f to each element of this traversable and collecting the results
in an traversable of type `That`. |
protected def
|
newAppended
[B >: A](that : Traversable[B]) : Transformed[B]
Boilerplate method, to override in each subclass
This method could be eliminated if Scala had virtual classes
|
protected[this] override def
|
newBuilder
: Builder[A, This]
The builder that builds instances of CC[A]
|
protected def
|
newDroppedWhile (p : (A) => Boolean) : Transformed[A] |
protected def
|
newFiltered (p : (A) => Boolean) : Transformed[A] |
protected def
|
newFlatMapped [B](f : (A) => Traversable[B]) : Transformed[B] |
protected def
|
newMapped [B](f : (A) => B) : Transformed[B] |
protected def
|
newSliced (_from : Int, _until : Int) : Transformed[A] |
protected def
|
newTakenWhile (p : (A) => Boolean) : Transformed[A] |
override def
|
slice
(from : Int, until : Int) : This
A sub-traversable starting at index `from`
and extending up to (but not including) index `until`.
|
override def
|
span
(p : (A) => Boolean) : (This, This)
Returns a pair consisting of the longest prefix of the traversable whose
elements all satisfy the given predicate, and the rest of the traversable.
|
override def
|
splitAt
(n : Int) : (This, This)
Split the traversable at a given point and return the two parts thus
created.
|
override def
|
take
(n : Int) : This
Return an traversable consisting only of the first
n
elements of this traversable, or else the whole traversable, if it has less
than n elements. |
override def
|
takeWhile
(p : (A) => Boolean) : This
Returns the longest prefix of this traversable whose elements satisfy
the predicate
p . |
protected abstract def
|
underlying : Coll |
Methods inherited from Traversable | |
companion |
Methods inherited from TraversableClass | |
foreach (abstract), genericBuilder, unzip, flatten, transpose |
Methods inherited from TraversableTemplate | |
thisCollection, isEmpty, nonEmpty, size, hasDefiniteSize, filterMap, filterNot, remove, partition, groupBy, forall, exists, count, find, foldLeft, /:, foldRight, :\, reduceLeft, reduceLeftOption, reduceRight, reduceRightOption, head, headOption, tail, last, lastOption, copyToBuffer, copyToArray, copyToArray, toArray, toList, toIterable, toSequence, toStream, toSet, mkString, mkString, mkString, addString, addString, addString, toString, stringPrefix, view, view |
Methods inherited from AnyRef | |
getClass, hashCode, equals, clone, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized |
Methods inherited from Any | |
==, !=, isInstanceOf, asInstanceOf |
Class Summary | |
trait
|
Appended
[B >: A] extends Transformed[B]
|
trait
|
DroppedWhile
extends Transformed[A]
|
trait
|
Filtered
extends Transformed[A]
|
trait
|
FlatMapped
[B] extends Transformed[B]
|
trait
|
Mapped
[B] extends Transformed[B]
|
trait
|
Sliced
extends Transformed[A]
pre: from >= 0
|
trait
|
TakenWhile
extends Transformed[A]
|
trait
|
Transformed
[+B] extends TraversableView[B, Coll] with AnyRef
|
Method Details |
protected abstract
def
underlying : Coll
protected
def
newAppended[B >: A](that : Traversable[B]) : Transformed[B]
protected
def
newMapped[B](f : (A) => B) : Transformed[B]
protected
def
newFlatMapped[B](f : (A) => Traversable[B]) : Transformed[B]
protected
def
newFiltered(p : (A) => Boolean) : Transformed[A]
protected
def
newSliced(_from : Int, _until : Int) : Transformed[A]
protected
def
newDroppedWhile(p : (A) => Boolean) : Transformed[A]
protected
def
newTakenWhile(p : (A) => Boolean) : Transformed[A]
override
def
++[B >: A, That](that : Traversable[B])(implicit
bf : BuilderFactory[B, That, This]) : That
that -
The traversable to appendoverride
def
++[B >: A, That](that : Iterator[B])(implicit
bf : BuilderFactory[B, That, This]) : That
that -
The iterator to appendf
to each element of this traversable and collecting the results
in an traversable of type `That`.f -
function to apply to each element.override
def
flatMap[B, That](f : (A) => Traversable[B])(implicit
bf : BuilderFactory[B, That, This]) : That
f
to each element of
this traversable, then concatenates the results in an traversable of type That.f -
the function to apply on each element.p
. The order of the elements is preserved.p -
the predicate used to filter the traversable.p
.override
def
init : This
n
first elements
If this traversable has less than n
elements, the empty
traversable is returned.n -
the number of elements to dropn
elements of this traversable, or else the whole traversable, if it has less
than n
elements.n -
the number of elements to takefrom -
The index of the first element of the returned subsequenceuntil -
The index of the element following the returned subsequencep
.p -
the test predicate.p
.p -
the test predicate.p -
the test predicatep
, and the rest of the traversable.n -
the position at which to splitn
elements, and the other elements.
Scala Library
|
|