Puts the elements of other collection after the elements of this collection (concatenation of 2 collections)
Puts the elements of other collection after the elements of this collection (concatenation of 2 collections)
The element at given index.
The element at given index.
Indices start at 0
; xs.apply(0)
is the first element of collection xs
.
Note the indexing syntax xs(i)
is a shorthand for xs.apply(i)
.
the index
the element at the given index
ArrayIndexOutOfBoundsException
if i < 0
or length <= i
Computes the multiset difference between this collection and another sequence.
Computes the multiset difference between this collection and another sequence.
the sequence of elements to remove
a new collection which contains all elements of this collection
except some of occurrences of elements that also appear in that
.
If an element value x
appears
n times in that
, then the first n occurrences of x
will not form
part of the result, but any following occurrences will.
2.0
Tests whether a predicate holds for at least one element of this collection.
Tests whether a predicate holds for at least one element of this collection.
the predicate used to test elements.
true
if the given predicate p
is satisfied by at least one element of this collection, otherwise false
Selects all elements of this collection which satisfy a predicate.
Selects all elements of this collection which satisfy a predicate.
the predicate used to test elements.
a new collection consisting of all elements of this collection that satisfy the given
predicate p
. The order of the elements is preserved.
2.0
Finds the first element of the collection satisfying a predicate, if any.
Finds the first element of the collection satisfying a predicate, if any.
the predicate used to test elements.
an option value containing the first element in the collection
that satisfies p
, or None
if none exists.
2.0
Builds a new collection by applying a function to all elements of this collection and using the elements of the resulting collections.
Builds a new collection by applying a function to all elements of this collection and using the elements of the resulting collections.
Function f
is constrained to be of the form x => x.someProperty
, otherwise
it is illegal.
the element type of the returned collection.
the function to apply to each element.
a new collection of type Coll[B]
resulting from applying the given collection-valued function
f
to each element of this collection and concatenating the results.
2.0
Applies a binary operator to a start value and all elements of this collection, going left to right.
Applies a binary operator to a start value and all elements of this collection, going left to right.
the result type of the binary operator.
the binary operator.
the result of inserting op
between consecutive elements of this collection,
going left to right with the start value z
on the left:
op(...op(z, x_1), x_2, ..., x_n)
where x1, ..., xn
are the elements of this collection.
Returns z
if this collection is empty.
Tests whether a predicate holds for all elements of this collection.
Tests whether a predicate holds for all elements of this collection.
the predicate used to test elements.
true
if this collection is empty or the given predicate p
holds for all elements of this collection, otherwise false
.
The element of the collection or default value.
The element of the collection or default value.
If an index is out of bounds (i < 0 || i >= length
) then default
value is returned.
the index
the element at the given index or default value if index is out or bounds
2.0
Partitions this collection into a map of collections according to some discriminator function.
Partitions this collection into a map of collections according to some discriminator function.
the type of keys returned by the discriminator function.
the discriminator function.
A map from keys to collections such that the following invariant holds:
(xs groupBy key)(k) = xs filter (x => key(x) == k)
That is, every key k
is bound to a collection of those elements x
for which key(x)
equals k
.
2.0
Partitions this collection into a map of collections according to some discriminator function.
Partitions this collection into a map of collections according to some discriminator function. Additionally projecting each element to a new value.
the type of keys returned by the discriminator function.
the type of values returned by the projection function.
the discriminator function.
projection function to produce new value for each element of this collection
A map from keys to collections such that the following invariant holds:
(xs groupByProjecting (key, proj))(k) = xs filter (x => key(x) == k).map(proj)
That is, every key k
is bound to projections of those elements x
for which key(x)
equals k
.
2.0
Finds index of first occurrence of some value in this collection after or at some start index.
Finds index of first occurrence of some value in this collection after or at some start index.
the element value to search for.
the start index
the index >= from
of the first element of this collection that is equal (as determined by ==
)
to elem
, or -1
, if none exists.
2.0
Finds index of the first element satisfying some predicate after or at some start index.
Finds index of the first element satisfying some predicate after or at some start index.
the predicate used to test elements.
the start index
the index >= from
of the first element of this collection that satisfies the predicate p
,
or -1
, if none exists.
2.0
Produces the range of all indices of this collection as a new collection containing [0 ..
Produces the range of all indices of this collection as a new collection containing [0 .. length-1] values.
2.0
Computes the multiset intersection between this collection and another sequence.
Computes the multiset intersection between this collection and another sequence.
the sequence of elements to intersect with.
a new collection which contains all elements of this collection
which also appear in that
.
If an element value x
appears
n times in that
, then the first n occurrences of x
will be retained
in the result, but any following occurrences will be omitted.
2.0
Tests whether this collection contains given index.
Tests whether this collection contains given index.
The implementations of methods apply
and isDefinedAt
turn a Coll[A]
into
a PartialFunction[Int, A]
.
the index to test
true
if this collection contains an element at position idx
, false
otherwise.
Tests whether the collection is empty.
Tests whether the collection is empty.
true
if the collection contains no elements, false
otherwise.
Returns true if the index in the valid range.
Finds index of last element satisfying some predicate before or at given end index.
Finds index of last element satisfying some predicate before or at given end index.
the predicate used to test elements.
the index <= end
of the last element of this collection that satisfies the predicate p
,
or -1
, if none exists.
2.0
The length of the collection.
The length of the collection.
Builds a new collection by applying a function to all elements of this collection.
Builds a new collection by applying a function to all elements of this collection.
the function to apply to each element.
a new collection of type Coll[B]
resulting from applying the given function
f
to each element of this collection and collecting the results.
Apply m for each element of this collection, group by key and reduce each group using r.
Apply m for each element of this collection, group by key and reduce each group using r.
2.0
Tests whether the collection is not empty.
Tests whether the collection is not empty.
true
if the collection contains at least one element, false
otherwise.
Partitions this collection in two collections according to a predicate.
Partitions this collection in two collections according to a predicate.
the predicate on which to partition.
a pair of collections: the first collection consists of all elements that
satisfy the predicate p
and the second collection consists of all elements
that don't. The relative order of the elements in the resulting collections
will BE preserved (this is different from Scala's version of this method).
2.0
Produces a new collection where a slice of elements in this collection is replaced by another sequence.
Produces a new collection where a slice of elements in this collection is replaced by another sequence.
the index of the first replaced element
the replacement sequence
the number of elements to drop in the original collection
a new collection consisting of all elements of this collection
except that replaced
elements starting from from
are replaced by patch
.
2.0
Returns new collection with elements in reversed order.
Returns new collection with elements in reversed order.
A new collection with all elements of this collection in reversed order.
Computes length of longest segment whose elements all satisfy some predicate.
Computes length of longest segment whose elements all satisfy some predicate.
the predicate used to test elements.
the index where the search starts.
the length of the longest segment of this collection starting from index from
such that every element of the segment satisfies the predicate p
.
2.0
The size of the collection in elements.
The size of the collection in elements.
Selects an interval of elements.
Selects an interval of elements. The returned collection is made up
of all elements x
which satisfy the invariant:
from <= indexOf(x) < until
the lowest index to include from this collection.
the lowest index to EXCLUDE from this collection.
Folding through all elements of this collection starting from m.zero and applying m.plus to accumulate resulting value.
Folding through all elements of this collection starting from m.zero and applying m.plus to accumulate resulting value.
monoid object to use for summation
result of the following operations (m.zero m.plus
x1 m.plus
x2 m.plus
... xN)
2.0
Selects first n elements.
Selects first n elements.
the number of elements to take from this collection.
a collection consisting only of the first n
elements of this collection,
or else the whole collection, if it has less than n
elements.
If n
is negative, returns an empty collection.
Produces a new collection which contains all distinct elements of this collection and also all elements of a given collection that are not in this collection.
Produces a new collection which contains all distinct elements of this collection and also all elements of
a given collection that are not in this collection.
This is order preserving operation considering only first occurrences of each distinct elements.
Any collection xs
can be transformed to a sequence with distinct elements by using xs.unionSet(Col()).
NOTE: Use append if you don't need set semantics.
the collection to add.
2.0
Returns a copy of this collection where elements at indexes
are replaced with values
.
Returns a copy of this collection where elements at indexes
are replaced with values
.
2.0
A copy of this collection with one single replaced element.
A copy of this collection with one single replaced element.
the position of the replacement
the replacing element
a new collection which is a copy of this collection with the element at position index
replaced by elem
.
2.0
IndexOutOfBoundsException
if index
does not satisfy 0 <= index < length
.
For this collection (x0, ..., xN) and other collection (y0, ..., yM) produces a collection ((x0, y0), ..., (xK, yK)) where K = min(N, M)
For this collection (x0, ..., xN) and other collection (y0, ..., yM) produces a collection ((x0, y0), ..., (xK, yK)) where K = min(N, M)
(Since version ) see corresponding Javadoc for more information.