Scala Library
|
|
trait
VectorTemplate[+A, +This <: VectorTemplate[A, This] with
Vector[A]]
extends
SequenceTemplate[A, This]Method Summary | |
override def
|
copyToArray
[B >: A](xs : Array[B], start : Int, len : Int) : Unit
Fills the given array
xs with at most `len` elements of
this traversable starting at position `start`.
Copying will stop once either the end of the current traversable is reached or
`len` elements have been copied or the end of the array is reached. |
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
|
dropRight
(n : Int) : This
Returns the iterable wihtout its rightmost
n elements. |
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
|
endsWith [B](that : Sequence[B]) : Boolean |
override def
|
equals
(that : Any) : Boolean
This method is used to compare the receiver object (
this )
with the argument object (arg0 ) for equivalence. |
override def
|
exists
(p : (A) => Boolean) : Boolean
Return true iff there is an element in this traversable for which the
given predicate `p` yields true.
|
override def
|
find
(p : (A) => Boolean) : Option[A]
Find and return the first element of the traversable object satisfying a
predicate, if any.
|
override def
|
foldLeft
[B](z : B)(op : (B, A) => B) : B
Combines the elements of this traversable object together using the binary
function
f , from left to right, and starting with
the value z . |
override def
|
foldRight
[B](z : B)(op : (A, B) => B) : B
Combines the elements of this iterable together using the binary
function
f , from right to left, and starting with
the value z . |
override def
|
forall
(p : (A) => Boolean) : Boolean
Return true iff the given predicate `p` yields true for all elements
of this traversable.
|
override def
|
foreach
[U](f : (A) => U) : Unit
Apply a function
f to all elements of this
traversable object. |
override def
|
head
: A
The first element of this iterable.
|
override def
|
indexWhere
(p : (A) => Boolean, from : Int) : Int
Returns index of the first element starting from a start index
satisying a predicate, or -1, if none exists.
|
override def
|
init
: This
An traversable consisting of all elements of this traversable except the last one.
|
override def
|
isEmpty
: Boolean
Does this iterable contain no elements?
|
override def
|
iterator
: Iterator[A]
Creates a new iterator over all elements contained in this
iterable object.
|
override def
|
last
: A
The last element of this traversable.
|
override def
|
lastIndexWhere
(p : (A) => Boolean, end : Int) : Int
Returns index of the last element not exceeding a given end index
and satisying a predicate, or -1 if none exists.
|
override def
|
lengthCompare
(len : Int) : Int
Result of comparing
length with operand len .
returns x where
x < 0 iff this.length < len
x == 0 iff this.length == len
x > 0 iff this.length > len .
The method as implemented here does not call length directly; its running time
is O(length min len) instead of O(length). The method should be overwritten
if computing length is cheap. |
override def
|
reduceLeft
[B >: A](op : (B, A) => B) : B
Combines the elements of this traversable object together using the binary
operator
op , from left to right |
override def
|
reduceRight
[B >: A](op : (A, B) => B) : B
Combines the elements of this iterable object together using the binary
operator
op , from right to left |
override def
|
reverse
: This
A sequence of type
C consisting of all elements of
this sequence in reverse order. |
override def
|
reverseIterator
: Iterator[A]
The elements of this sequence in reversed order
|
override def
|
sameElements
[B >: A](that : Iterable[B]) : Boolean
Checks if the other iterable object contains the same elements as this one.
|
override def
|
segmentLength
(p : (A) => Boolean, from : Int) : Int
Returns length of longest segment starting from a start index `from`
such that every element of the segment satisfies predicate `p`.
|
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
|
startsWith
[B](that : Sequence[B], offset : Int) : Boolean
Checks whether the argument sequence is contained at the
specified index within the receiver object.
If the both the receiver object,
this and
the argument, that are infinite sequences
this method may not terminate. |
override def
|
tail
: This
An traversable consisting of all elements of this traversable
except the first one.
|
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
|
takeRight
(n : Int) : This
Returns the rightmost
n elements from this iterable. |
override def
|
takeWhile
(p : (A) => Boolean) : This
Returns the longest prefix of this traversable whose elements satisfy
the predicate
p . |
override def
|
view
: VectorView[A, This]
Creates a view of this iterable @see IterableView
|
override def
|
view
(from : Int, until : Int) : VectorView[A, This]
A sub-iterable view starting at index `from`
and extending up to (but not including) index `until`.
|
override def
|
zip
[A1 >: A, B, That](that : Sequence[B])(implicit bf : BuilderFactory[(A1, B), That, This]) : That
Returns an iterable formed from this iterable and another iterable
by combining corresponding elements in pairs.
If one of the two iterables is longer than the other, its remaining elements are ignored.
|
override def
|
zipWithIndex
[A1 >: A, That](implicit bf : BuilderFactory[(A1, Int), That, This]) : That
Zips this iterable with its indices (startiong from 0).
|
Methods inherited from SequenceTemplate | |
length (abstract), apply (abstract), size, isDefinedAt, zipAll, prefixLength, indexWhere, findIndexOf, indexOf, indexOf, lastIndexOf, lastIndexOf, lastIndexWhere, reversedElements, startsWith, indexOfSeq, indexOfSeq, lastIndexOfSeq, lastIndexOfSeq, contains, union, diff, intersect, removeDuplicates, patch, padTo, toSequence, indices, toString, sortWith, findLastIndexOf, slice, equalsWith, containsSlice, projection |
Methods inherited from IterableTemplate | |
elements, toIterable, toStream, first, firstOption, toSeq |
Methods inherited from TraversableTemplate | |
newBuilder (abstract), thisCollection, nonEmpty, hasDefiniteSize, ++, ++, map, flatMap, filter, filterMap, filterNot, remove, partition, groupBy, count, /:, :\, reduceLeftOption, reduceRightOption, headOption, lastOption, copyToBuffer, copyToArray, toArray, toList, toSet, mkString, mkString, mkString, addString, addString, addString, stringPrefix |
Methods inherited from AnyRef | |
getClass, hashCode, clone, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized |
Methods inherited from Any | |
==, !=, isInstanceOf, asInstanceOf |
Class Summary | |
protected class
|
Elements
(start : Int, end : Int) extends BufferedIterator[A]
The iterator returned by the iterator method
|
Method Details |
override
def
isEmpty : Boolean
f
to all elements of this
traversable object.f -
A function that is applied for its side-effect to every element. The result (of arbitrary type U) of function `f` is discarded.p -
the predicatep -
the predicatep -
the predicatep
, or None
if none exists.f
, from left to right, and starting with
the value z
.f(... (f(f(z, a0), a1) ...), an)
if the traversable is
[a0, a1, ..., an]
.f
, from right to left, and starting with
the value z
.f(a0, f(a1, f(..., f(an, z)...)))
if the iterable is [a0, a1, ..., an]
.op
, from left to rightop -
The operator to applyop(... op(a0,a1), ..., an)
if the traversable object has elements
a0, a1, ..., an
.op
, from right to leftop -
The operator to applya0 op (... op (an-1 op an)...)
if the iterable object has elements a0, a1, ...,
an
.override
def
zip[A1 >: A, B, That](that : Sequence[B])(implicit
bf : BuilderFactory[(A1, B), That, This]) : That
that -
The iterable providing the second half of each result pairoverride
def
zipWithIndex[A1 >: A, That](implicit
bf : BuilderFactory[(A1, Int), That, This]) : That
from -
The index of the first element of the returned subsequenceuntil -
The index of the element following the returned subsequenceoverride
def
head : A
override
def
tail : This
override
def
last : A
override
def
init : This
n
elements of this traversable, or else the whole traversable, if it has less
than n
elements.n -
the number of elements to taken
first elements
If this traversable has less than n
elements, the empty
traversable is returned.n -
the number of elements to dropn
elements from this iterable.n -
the number of elements to taken
elements.n -
the number of elements to taken -
the position at which to splitn
elements, and the other elements.p
.p -
the test predicate.p
.p -
the test predicate.p -
the test predicatep
, and the rest of the traversable.that -
the other iterablexs
with at most `len` elements of
this traversable starting at position `start`.
Copying will stop once either the end of the current traversable is reached or
`len` elements have been copied or the end of the array is reached.xs -
the array to fill.start -
starting index.len -
number of elements to copylength
with operand len
.
returns x
where
x < 0
iff this.length < len
x == 0
iff this.length == len
x > 0
iff this.length > len
.
The method as implemented here does not call length directly; its running time
is O(length min len) instead of O(length). The method should be overwritten
if computing length is cheap.p -
the predicatefrom -
the start indexp -
the predicatefrom -
the start indexend -
the end indexp -
the predicateoverride
def
reverse : This
C
consisting of all elements of
this sequence in reverse order.this(length - 1), ..., this(0)
If random access is inefficient for the given sequence implementation,
this operation should be overridden.this
and
the argument, that
are infinite sequences
this method may not terminate.that
is contained in this
, at the specified index, otherwise falsethis
)
with the argument object (arg0
) for equivalence.
The default implementations of this method is an equivalence relation:
x
of type Any
,
x.equals(x)
should return true
.x
and y
of type
Any
, x.equals(y)
should return true
if and only
if y.equals(x)
returns true
.x
, y
, and z
of type AnyRef
if x.equals(y)
returns true
and
y.equals(z)
returns
true
, then x.equals(z)
should return true
.
If you override this method, you should verify that
your implementation remains an equivalence relation.
Additionally, when overriding this method it is often necessary to
override hashCode
to ensure that objects that are
"equal" (o1.equals(o2)
returns true
)
hash to the same Int
(o1.hashCode.equals(o2.hashCode)
).
arg0 -
the object to compare against this object for equality.true
if the receiver object is equivalent to the argument; false
otherwise. override
def
view : VectorView[A, This]
override
def
view(from : Int, until : Int) : VectorView[A, This]
from -
The index of the first element of the sliceuntil -
The index of the element following the slice
Scala Library
|
|