Extensions
Attributes
- Source
- Extensions.scala
- Graph
-
- Supertypes
- Self type
-
Extensions.type
Members list
Givens
Givens
Attributes
- Source
- Extensions.scala
Attributes
- Source
- Extensions.scala
Attributes
- Source
- Extensions.scala
Attributes
- Source
- Extensions.scala
Attributes
- Source
- Extensions.scala
Attributes
- Source
- Extensions.scala
Attributes
- Source
- Extensions.scala
Extensions
Extensions
Attributes
- Source
- Extensions.scala
Attributes
- Source
- Extensions.scala
Attributes
- Source
- Extensions.scala
Attributes
- Source
- Extensions.scala
Attributes
- Source
- Extensions.scala
Attributes
- Source
- Extensions.scala
Attributes
- Source
- Extensions.scala
Attributes
- Source
- Extensions.scala
Attributes
- Source
- Extensions.scala
Attributes
- Source
- Extensions.scala
Attributes
- Source
- Extensions.scala
Attributes
- Source
- Extensions.scala
Attributes
- Source
- Extensions.scala
Attributes
- Source
- Extensions.scala
Attributes
- Source
- Extensions.scala
Attributes
- Source
- Extensions.scala
Attributes
- Source
- Extensions.scala
Attributes
- Source
- Extensions.scala
Attributes
- Source
- Extensions.scala
Attributes
- Source
- Extensions.scala
Attributes
- Source
- Extensions.scala
Attributes
- Source
- Extensions.scala
Attributes
- Source
- Extensions.scala
Attributes
- Source
- Extensions.scala
Attributes
- Source
- Extensions.scala
Attributes
- Source
- Extensions.scala
Attributes
- Source
- Extensions.scala
Attributes
- Source
- Extensions.scala
Attributes
- Source
- Extensions.scala
Attributes
- Source
- Extensions.scala
Attributes
- Source
- Extensions.scala
A copy of this array with an element appended.
A copy of this array with all elements of a collection appended.
A copy of this array with all elements of an array appended.
Builds a new array by applying a partial function to all elements of this array on which the function is defined.
Builds a new array by applying a partial function to all elements of this array on which the function is defined.
Type parameters
- B
-
the element type of the returned array.
Value parameters
- pf
-
the partial function which filters and maps the array.
Attributes
- Returns
-
a new array resulting from applying the given partial function
pfto each element on which it is defined and collecting the results. The order of the elements is preserved. - Source
- Extensions.scala
Finds the first element of the array for which the given partial function is defined, and applies the partial function to it.
Finds the first element of the array for which the given partial function is defined, and applies the partial function to it.
Attributes
- Source
- Extensions.scala
Attributes
- Source
- Extensions.scala
Attributes
- Source
- Extensions.scala
Tests whether this array contains a given value as an element.
Tests whether this array contains a given value as an element.
Value parameters
- elem
-
the element to test.
Attributes
- Returns
-
trueif this array has an element that is equal (as determined by==) toelem,falseotherwise. - Source
- Extensions.scala
Attributes
- Source
- Extensions.scala
Copy elements of this array to another array. Fills the given array xs starting at index 0. Copying will stop once either all the elements of this array have been copied, or the end of the array is reached.
Copy elements of this array to another array. Fills the given array xs starting at index 0. Copying will stop once either all the elements of this array have been copied, or the end of the array is reached.
Type parameters
- B
-
the type of the elements of the array.
Value parameters
- xs
-
the array to fill.
Attributes
- Source
- Extensions.scala
Copy elements of this array to another array. Fills the given array xs starting at index start. Copying will stop once either all the elements of this array have been copied, or the end of the array is reached.
Copy elements of this array to another array. Fills the given array xs starting at index start. Copying will stop once either all the elements of this array have been copied, or the end of the array is reached.
Type parameters
- B
-
the type of the elements of the array.
Value parameters
- start
-
the starting index within the destination array.
- xs
-
the array to fill.
Attributes
- Source
- Extensions.scala
Copy elements of this array to another array. Fills the given array xs starting at index start with at most len values. Copying will stop once either all the elements of this array have been copied, or the end of the array is reached, or len elements have been copied.
Copy elements of this array to another array. Fills the given array xs starting at index start with at most len values. Copying will stop once either all the elements of this array have been copied, or the end of the array is reached, or len elements have been copied.
Type parameters
- B
-
the type of the elements of the array.
Value parameters
- len
-
the maximal number of elements to copy.
- start
-
the starting index within the destination array.
- xs
-
the array to fill.
Attributes
- Source
- Extensions.scala
Copy elements of this array to another array. Fills the given array xs starting at index 0. Copying will stop once either all the elements of this array have been copied, or the end of the array is reached.
Copy elements of this array to another array. Fills the given array xs starting at index 0. Copying will stop once either all the elements of this array have been copied, or the end of the array is reached.
Type parameters
- B
-
the type of the elements of the array.
Value parameters
- xs
-
the array to fill.
Attributes
- Source
- Extensions.scala
Copy elements of this array to another array. Fills the given array xs starting at index start. Copying will stop once either all the elements of this array have been copied, or the end of the array is reached.
Copy elements of this array to another array. Fills the given array xs starting at index start. Copying will stop once either all the elements of this array have been copied, or the end of the array is reached.
Type parameters
- B
-
the type of the elements of the array.
Value parameters
- start
-
the starting index within the destination array.
- xs
-
the array to fill.
Attributes
- Source
- Extensions.scala
Copy elements of this array to another array. Fills the given array xs starting at index start with at most len values. Copying will stop once either all the elements of this array have been copied, or the end of the array is reached, or len elements have been copied.
Copy elements of this array to another array. Fills the given array xs starting at index start with at most len values. Copying will stop once either all the elements of this array have been copied, or the end of the array is reached, or len elements have been copied.
Type parameters
- B
-
the type of the elements of the array.
Value parameters
- len
-
the maximal number of elements to copy.
- start
-
the starting index within the destination array.
- xs
-
the array to fill.
Attributes
- Source
- Extensions.scala
Counts the number of elements in this array which satisfy a predicate
Counts the number of elements in this array which satisfy a predicate
Attributes
- Source
- Extensions.scala
Computes the multiset difference between this array and another sequence.
Computes the multiset difference between this array and another sequence.
Value parameters
- that
-
the sequence of elements to remove
Attributes
- Returns
-
a new array which contains all elements of this array except some of occurrences of elements that also appear in
that. If an element valuexappears ''n'' times inthat, then the first ''n'' occurrences ofxwill not form part of the result, but any following occurrences will. - Source
- Extensions.scala
Selects all the elements of this array ignoring the duplicates.
Selects all the elements of this array ignoring the duplicates.
Attributes
- Returns
-
a new array consisting of all the elements of this array without duplicates.
- Source
- Extensions.scala
Selects all the elements of this array ignoring the duplicates as determined by == after applying the transforming function f.
Selects all the elements of this array ignoring the duplicates as determined by == after applying the transforming function f.
Type parameters
- B
-
the type of the elements after being transformed by
f
Value parameters
- f
-
The transforming function whose result is used to determine the uniqueness of each element
Attributes
- Returns
-
a new array consisting of all the elements of this array without duplicates.
- Source
- Extensions.scala
The rest of the NArray without its n first elements.
The rest of the NArray without its n last elements.
Drops longest prefix of elements that satisfy a predicate.
Drops longest prefix of elements that satisfy a predicate.
Value parameters
- p
-
The predicate used to test ele nts.
Attributes
- Returns
-
the longest suffix of this NArray whose first element does not satisfy the predicate
p. - Source
- Extensions.scala
Tests whether this array ends with the given array.
Tests whether this array ends with the given array.
Value parameters
- that
-
the array to test
Attributes
- Returns
-
trueif this array hasthatas a suffix,falseotherwise. - Source
- Extensions.scala
Tests whether this array ends with the given sequence.
Tests whether this array ends with the given sequence.
Value parameters
- that
-
the sequence to test
Attributes
- Returns
-
trueif this array hasthatas a suffix,falseotherwise. - Source
- Extensions.scala
Tests whether a predicate holds for at least one element of this array.
Tests whether a predicate holds for at least one element of this array.
Value parameters
- p
-
the predicate used to test elements.
Attributes
- Returns
-
trueif the given predicatepis satisfied by at least one element of this array, otherwisefalse - Source
- Extensions.scala
Selects all elements of this array which satisfy a predicate.
Selects all elements of this array which satisfy a predicate.
Value parameters
- p
-
the predicate used to test elements.
Attributes
- Returns
-
a new array consisting of all elements of this array that satisfy the given predicate
p. - Source
- Extensions.scala
Selects all elements of this array which do not satisfy a predicate.
Selects all elements of this array which do not satisfy a predicate.
Value parameters
- pred
-
the predicate used to test elements.
Attributes
- Returns
-
a new array consisting of all elements of this array that do not satisfy the given predicate
pred. - Source
- Extensions.scala
Finds the first element of the array satisfying a predicate, if any.
Finds the first element of the array satisfying a predicate, if any.
Value parameters
- p
-
the predicate used to test elements.
Attributes
- Returns
-
an option value containing the first element in the array that satisfies
p, orNoneif none exists. - Source
- Extensions.scala
Builds a new array by applying a function to all elements of this array and using the elements of the resulting collections.
Builds a new array by applying a function to all elements of this array and using the elements of the resulting collections.
Type parameters
- B
-
the element type of the returned array.
Value parameters
- f
-
the function to apply to each element.
Attributes
- Returns
-
a new array resulting from applying the given collection-valued function
fto each element of this array and concatenating the results. - Source
- Extensions.scala
Attributes
- Source
- Extensions.scala
Flattens a two-dimensional array by concatenating all its rows into a single array.
Flattens a two-dimensional array by concatenating all its rows into a single array.
Type parameters
- B
-
Type of row elements.
Value parameters
- asIterable
-
A function that converts elements of this array to rows - Iterables of type
B.
Attributes
- Returns
-
An array obtained by concatenating rows of this array.
- Source
- Extensions.scala
Alias for foldLeft.
Alias for foldLeft.
The type parameter is more restrictive than for foldLeft to be consistent with IterableOnceOps.fold.
Type parameters
- A1
-
The type parameter for the binary operator, a supertype of
A.
Value parameters
- op
-
A binary operator.
- z
-
An initial value.
Attributes
- Returns
-
The result of applying
optozand all elements of this array, going left to right. Returnszif this string is empty. - Source
- Extensions.scala
Applies the given binary operator op to the given initial value z and all elements of this array, going left to right. Returns the initial value if this array is empty.
Applies the given binary operator op to the given initial value z and all elements of this array, going left to right. Returns the initial value if this array is empty.
If x,,1,,, x,,2,,, ..., x,,n,, are the elements of this array, the result is op( op( ... op( op(z, x,,1,,), x,,2,,) ... ), x,,n,,).
Type parameters
- B
-
The result type of the binary operator.
Value parameters
- op
-
A binary operator.
- z
-
An initial value.
Attributes
- Returns
-
The result of applying
optozand all elements of this array, going left to right. Returnszif this array is empty. - Source
- Extensions.scala
Applies the given binary operator op to all elements of this array and the given initial value z, going right to left. Returns the initial value if this array is empty.
Applies the given binary operator op to all elements of this array and the given initial value z, going right to left. Returns the initial value if this array is empty.
If x,,1,,, x,,2,,, ..., x,,n,, are the elements of this array, the result is op(x,,1,,, op(x,,2,,, op( ... op(x,,n,,, z) ... ))).
Type parameters
- B
-
The result type of the binary operator.
Value parameters
- op
-
A binary operator.
- z
-
An initial value.
Attributes
- Returns
-
The result of applying
opto all elements of this array andz, going right to left. Returnszif this array is empty. - Source
- Extensions.scala
Tests whether a predicate holds for all elements of this array.
Tests whether a predicate holds for all elements of this array.
Value parameters
- p
-
the predicate used to test elements.
Attributes
- Returns
-
trueif this array is empty or the given predicatepholds for all elements of this array, otherwisefalse. - Source
- Extensions.scala
Apply f to each element for side effects. Note: [U] parameter needed to help scalac's type inference.
Apply f to each element for side effects. Note: [U] parameter needed to help scalac's type inference.
Attributes
- Source
- Extensions.scala
Partitions this array into a map of arrays according to some discriminator function.
Partitions this array into a map of arrays according to some discriminator function.
Type parameters
- K
-
the type of keys returned by the discriminator function.
Value parameters
- f
-
the discriminator function.
Attributes
- Returns
-
A map from keys to arrays such that the following invariant holds:
(xs groupBy f)(k) = xs filter (x => f(x) == k)That is, every key `k` is bound to an array of those elements `x` for which `f(x)` equals `k`. - Source
- Extensions.scala
Partitions this array into a map of arrays according to a discriminator function key. Each element in a group is transformed into a value of type B using the value function.
Partitions this array into a map of arrays according to a discriminator function key. Each element in a group is transformed into a value of type B using the value function.
It is equivalent to groupBy(key).mapValues(_.map(f)), but more efficient.
case class User(name: String, age: Int)
def namesByAge(users: Array[User]): Map[Int, Array[String]] =
users.groupMap(_.age)(_.name)
Type parameters
- B
-
the type of values returned by the transformation function
- K
-
the type of keys returned by the discriminator function
Value parameters
- f
-
the element transformation function
- key
-
the discriminator function
Attributes
- Source
- Extensions.scala
Attributes
- Source
- Extensions.scala
Attributes
- Source
- Extensions.scala
Optionally selects the first element.
Optionally selects the first element.
Attributes
- Returns
-
the first element of this NArray if it is nonempty,
Noneif it is empty. - Source
- Extensions.scala
Finds index of first occurrence of some value in this array.
Finds index of first occurrence of some value in this array.
Value parameters
- elem
-
the element value to search for.
Attributes
- Returns
-
the index
>= fromof the first element of this array that is equal (as determined by==) toelem, or-1, if none exists. - Source
- Extensions.scala
Finds index of first occurrence of some value in this array after or at some start index.
Finds index of first occurrence of some value in this array after or at some start index.
Value parameters
- elem
-
the element value to search for.
- from
-
the start index
Attributes
- Returns
-
the index
>= fromof the first element of this array that is equal (as determined by==) toelem, or-1, if none exists. - Source
- Extensions.scala
Finds index of the first element satisfying some predicate.
Finds index of the first element satisfying some predicate.
Value parameters
- p
-
the predicate used to test elements.
Attributes
- Returns
-
the index
>= 0of the first element of this array that satisfies the predicatep, or-1, if none exists. - Source
- Extensions.scala
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.
Value parameters
- from
-
the start index
- p
-
the predicate used to test elements.
Attributes
- Returns
-
the index
>= fromof the first element of this array that satisfies the predicatep, or-1, if none exists. - Source
- Extensions.scala
Produces the range of all indices of this sequence.
Produces the range of all indices of this sequence.
Attributes
- Returns
-
a
Rangevalue from0to one less than the length of this array. - Source
- Extensions.scala
The initial part of the NArray without its last element.
Iterates over the inits of this array.
Iterates over the inits of this array.
The first value will be this array and the final one will be an empty array, with the intervening values the results of successive applications of init.
Attributes
- Returns
-
an iterator over all the inits of this array
- Source
- Extensions.scala
Computes the multiset intersection between this array and another sequence.
Computes the multiset intersection between this array and another sequence.
Value parameters
- that
-
the sequence of elements to intersect with.
Attributes
- Returns
-
a new array which contains all elements of this array which also appear in
that. If an element valuexappears ''n'' times inthat, then the first ''n'' occurrences ofxwill be retained in the result, but any following occurrences will be omitted. - Source
- Extensions.scala
Tests whether the NArray is empty.
Tests whether the NArray is empty.
Attributes
- Returns
-
trueif the NArray contains no elements,falseotherwise. - Source
- Extensions.scala
Attributes
- Returns
-
an iterator for this AT
- Source
- Extensions.scala
The width of this NArray.
The width of this NArray.
Attributes
- Returns
-
the number of elements in this NArray.
- Source
- Extensions.scala
Attributes
- Source
- Extensions.scala
Finds index of last occurrence of some value in this array.
Finds index of last occurrence of some value in this array.
Value parameters
- elem
-
the element value to search for.
Attributes
- Returns
-
the index
<= length - 1of the last element of this array that is equal (as determined by==) toelem, or-1, if none exists. - Source
- Extensions.scala
Finds index of last occurrence of some value in this array before or at a given end index.
Finds index of last occurrence of some value in this array before or at a given end index.
Value parameters
- elem
-
the element value to search for.
- end
-
the end index.
Attributes
- Returns
-
the index
<= endof the last element of this array that is equal (as determined by==) toelem, or-1, if none exists. - Source
- Extensions.scala
Finds index of last element satisfying some predicate.
Finds index of last element satisfying some predicate.
Value parameters
- p
-
the predicate used to test elements.
Attributes
- Returns
-
the index of the last element of this array that satisfies the predicate
p, or-1, if none exists. - Source
- Extensions.scala
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.
Value parameters
- p
-
the predicate used to test elements.
Attributes
- Returns
-
the index
<= endof the last element of this array that satisfies the predicatep, or-1, if none exists. - Source
- Extensions.scala
Optionally selects the last element.
Optionally selects the last element.
Attributes
- Returns
-
the last element of this NArray$ if it is nonempty,
Noneif it is empty. - Source
- Extensions.scala
Compares the length of this NArray to a test value. *
Compares the length of this NArray to a test value. *
Value parameters
- len
-
the test value that gets compared with the le h.
Attributes
- Returns
-
A value
xrex < 0 if this.length < len x == 0 if this.length == len x > 0 if this.length > len - Source
- Extensions.scala
Method mirroring SeqOps.lengthIs for consistency, except it returns an Int because length is known and comparison is constant-time.
Method mirroring SeqOps.lengthIs for consistency, except it returns an Int because length is known and comparison is constant-time.
These operations are equivalent to `lengthCompare(Int)`, and allow the following more readable usages:
this.lengthIs < len // this.lengthCompare(len) < 0
this.lengthIs <= len // this.lengthCompare(len) <= 0
this.lengthIs == len // this.lengthCompare(len) == 0
this.lengthIs != len // this.lengthCompare(len) != 0
this.lengthIs >= len // this.lengthCompare(len) >= 0
this.lengthIs > len // this.lengthCompare(len) > 0
Attributes
- Source
- Extensions.scala
Builds a new array by applying a function to all elements of this array.
Builds a new array by applying a function to all elements of this array.
Type parameters
- B
-
the element type of the returned array.
Value parameters
- f
-
the function to apply to each element.
Attributes
- Returns
-
a new array resulting from applying the given function
fto each element of this array and collecting the results. - Source
- Extensions.scala
Maps each element of this array to a new element of the same type. This 'in place' operation overwrites the original data.
Maps each element of this array to a new element of the same type. This 'in place' operation overwrites the original data.
Value parameters
- f
-
the function to apply to each element.
Attributes
- Returns
-
a reference to this array, after mapping took place.
- Source
- Extensions.scala
Tests whether the NArray is not empty.
Tests whether the NArray is not empty.
Attributes
- Returns
-
trueif the NArray contains at least one element,falseotherwise. - Source
- Extensions.scala
A copy of this array with an element value appended until a given target length is reached.
A copy of this array with an element value appended until a given target length is reached.
Type parameters
- B
-
the element type of the returned array.
Value parameters
- elem
-
the padding value
- len
-
the target length
Attributes
- Returns
-
a new array consisting of all elements of this array followed by the minimal number of occurrences of
elemso that the resulting collection has a length of at leastlen. that the resulting collection has a length of at leastlen. - Source
- Extensions.scala
A pair of, first, all elements that satisfy predicate p and, second, all elements that do not.
A pair of, first, all elements that satisfy predicate p and, second, all elements that do not.
Attributes
- Source
- Extensions.scala
Applies a function f to each element of the array and returns a pair of arrays: the first one made of those values returned by f that were wrapped in scala.util.Left, and the second one made of those wrapped in scala.util.Right.
Applies a function f to each element of the array and returns a pair of arrays: the first one made of those values returned by f that were wrapped in scala.util.Left, and the second one made of those wrapped in scala.util.Right.
Example:
val xs = js.Array(1, "one", 2, "two", 3, "three").partitionMap {
case i: Int => Left(i)
case s: String => Right(s)
}
// xs == (js.Array(1, 2, 3),
// js.Array("one", "two", "three"))
Type parameters
- A1
-
the element type of the first resulting collection
- A2
-
the element type of the second resulting collection
Value parameters
- f
-
the 'split function' mapping the elements of this array to an scala.util.Either
Attributes
- Returns
-
a pair of arrays: the first one made of those values returned by
fthat were wrapped in scala.util.Left, and the second one made of those wrapped in scala.util.Right. - Source
- Extensions.scala
Returns a copy of this array with patched values. Patching at negative indices is the same as patching starting at 0. Patching at indices at or larger than the length of the original array appends the patch to the end. If more values are replaced than actually exist, the excess is ignored.
Returns a copy of this array with patched values. Patching at negative indices is the same as patching starting at 0. Patching at indices at or larger than the length of the original array appends the patch to the end. If more values are replaced than actually exist, the excess is ignored.
Value parameters
- from
-
The start index from which to patch
- other
-
The patch values
- replaced
-
The number of values in the original array that are replaced by the patch.
Attributes
- Source
- Extensions.scala
A copy of this array with an element prepended.
A copy of this array with all elements of a collection prepended.
A copy of this array with all elements of a collection prepended.
Attributes
- Source
- Extensions.scala
A copy of this array with all elements of an array prepended.
Returns a new array with the elements in reversed order.
An iterator yielding elements in reversed order.
An iterator yielding elements in reversed order.
Note: xs.reverseIterator is the same as xs.reverse.iterator but implemented more efficiently.
Attributes
- Returns
-
an iterator yielding the elements of this array in reversed order
- Source
- Extensions.scala
Computes a prefix scan of the elements of the array.
Computes a prefix scan of the elements of the array.
Note: The neutral element z may be applied more than once.
Type parameters
- B
-
element type of the resulting array
Value parameters
- op
-
the associative operator for the scan
- z
-
neutral element for the operator
op
Attributes
- Returns
-
a new array containing the prefix scan of the elements in this array
- Source
- Extensions.scala
Produces an array containing cumulative results of applying the binary operator going left to right.
Produces an array containing cumulative results of applying the binary operator going left to right.
Type parameters
- B
-
the result type of the binary operator.
Value parameters
- op
-
the binary operator.
- z
-
the start value.
Attributes
- Returns
-
array with intermediate values. Example:
Array(1, 2, 3, 4).scanLeft(0)(_ + _) == Array(0, 1, 3, 6, 10) - Source
- Extensions.scala
Produces an array containing cumulative results of applying the binary operator going right to left.
Produces an array containing cumulative results of applying the binary operator going right to left.
Type parameters
- B
-
the result type of the binary operator.
Value parameters
- op
-
the binary operator.
- z
-
the start value.
Attributes
- Returns
-
array with intermediate values. Example:
Array(4, 3, 2, 1).scanRight(0)(_ + _) == Array(10, 6, 3, 1, 0) - Source
- Extensions.scala
The width of this NArray.
The width of this NArray.
Attributes
- Returns
-
the number of elements in this NArray.
- Source
- Extensions.scala
Compares the width of this NArray to a test value.
Compares the width of this NArray to a test value.
Value parameters
- otherSize
-
the test value that gets compared with the width.
Attributes
- Returns
-
A value
xwherex < 0 if this.width < otherSize x == 0 if this.width == otherSize x > 0 if this.width > otherSize - Source
- Extensions.scala
Method mirroring SeqOps.sizeIs for consistency, except it returns an Int because width is known and comparison is constant-time.
Method mirroring SeqOps.sizeIs for consistency, except it returns an Int because width is known and comparison is constant-time.
These operations are equivalent to `sizeCompare(Int)`, and allow the following more readable usages:
this.sizeIs < width // this.sizeCompare(width) < 0
this.sizeIs <= width // this.sizeCompare(width) <= 0
this.sizeIs == width // this.sizeCompare(width) == 0
this.sizeIs != width // this.sizeCompare(width) != 0
this.sizeIs >= width // this.sizeCompare(width) >= 0
this.sizeIs > width // this.sizeCompare(width) > 0
Attributes
- Source
- Extensions.scala
Selects an interval of elements. The returned array is made up of all elements x which satisfy the invariant:
Selects an interval of elements. The returned array is made up of all elements x which satisfy the invariant:
from <= indexOf(x) < until
Value parameters
- from
-
the lowest index to include from this array.
Attributes
- Returns
-
an array containing the elements greater than or equal to index
fromextending through the end of this array. - Source
- Extensions.scala
Selects an interval of elements. The returned array is made up of all elements x which satisfy the invariant:
Selects an interval of elements. The returned array is made up of all elements x which satisfy the invariant:
from <= indexOf(x) < until
Value parameters
- from
-
the lowest index to include from this array.
- until
-
the lowest index to EXCLUDE from this array.
Attributes
- Returns
-
an array containing the elements greater than or equal to index
fromextending up to (but not including) indexuntilof this array. - Source
- Extensions.scala
Groups elements in fixed width blocks by passing a "sliding window" over them (as opposed to partitioning them, as is done in grouped.)
Groups elements in fixed width blocks by passing a "sliding window" over them (as opposed to partitioning them, as is done in grouped.)
Value parameters
- step
-
the distance between the first elements of successive groups
- width
-
the number of elements per group
Attributes
- Returns
-
An iterator producing arrays of width
width, except the last element (which may be the only element) will be truncated if there are fewer thanwidthelements remaining to be grouped. - See also
-
scala.collection.Iterator, method
sliding - Source
- Extensions.scala
Sorts this array according to the Ordering which results from transforming an implicitly given Ordering with a transformation function.
Sorts this array according to the Ordering which results from transforming an implicitly given Ordering with a transformation function.
Type parameters
- B
-
the target type of the transformation
f, and the type where the orderingordis defined.
Value parameters
- f
-
the transformation function mapping elements to some other domain
B. - ord
-
the ordering assumed on domain
B.
Attributes
- Returns
-
an array consisting of the elements of this array sorted according to the ordering where
x < yiford.lt(f(x), f(y)). - See also
- Source
- Extensions.scala
Sorts this array according to a comparison function.
Sorts this array according to a comparison function.
The sort is stable. That is, elements that are equal (as determined by lt) appear in the same order in the sorted sequence as in the original.
Value parameters
- lt
-
the comparison function which tests whether its first argument precedes its second argument in the desired ordering.
Attributes
- Returns
-
an array consisting of the elements of this array sorted according to the comparison function
lt. - Source
- Extensions.scala
Splits this array into a prefix/suffix pair according to a predicate.
Splits this array into a prefix/suffix pair according to a predicate.
Note: c span p is equivalent to (but more efficient than) (c takeWhile p, c dropWhile p), provided the evaluation of the predicate p does not cause any side-effects.
Value parameters
- p
-
the test predicate
Attributes
- Returns
-
a pair consisting of the longest prefix of this array whose elements all satisfy
p, and the rest of this array. - Source
- Extensions.scala
Splits this array into two at a given position. Note: c splitAt n is equivalent to (c take n, c drop n).
Splits this array into two at a given position. Note: c splitAt n is equivalent to (c take n, c drop n).
Value parameters
- n
-
the position at which to split.
Attributes
- Returns
-
a pair of arrays consisting of the first
nelements of this array, and the other elements. - Source
- Extensions.scala
Tests whether this array starts with the given array.
Tests whether this array contains the given array at a given index.
Tests whether this array contains the given array at a given index.
Value parameters
- offset
-
the index where the array is searched.
- that
-
the array to test
Attributes
- Returns
-
trueif the arraythatis contained in this array at indexoffset, otherwisefalse. - Source
- Extensions.scala
Tests whether this array contains the given sequence at a given index.
Tests whether this array contains the given sequence at a given index.
Value parameters
- offset
-
the index where the sequence is searched.
- that
-
the sequence to test
Attributes
- Returns
-
trueif the sequencethatis contained in this array at indexoffset, otherwisefalse. - Source
- Extensions.scala
The rest of the NArray without its first element.
Iterates over the tails of this array.
Iterates over the tails of this array.
The first value will be this array and the final one will be an empty array, with the intervening values the results of successive applications of tail.
Attributes
- Returns
-
an iterator over all the tails of this array
- Source
- Extensions.scala
An NArray containing the first n elements of this NArray.
An NArray containing the last n elements of this NArray.
Takes longest prefix of elements that satisfy a predicate.
Takes longest prefix of elements that satisfy a predicate.
Value parameters
- p
-
The predicate used to test ele nts.
Attributes
- Returns
-
the longest prefix of this NArray whose elements all satisfy the predicate
p. - Source
- Extensions.scala
Create a JVM/Native style copy of this array with the specified element type.
Create a JVM/Native style copy of this array with the specified element type.
Attributes
- Source
- Extensions.scala
Attributes
- Source
- Extensions.scala
Create a copy of this array with the specified element type.
Attributes
- Source
- Extensions.scala
Converts an array of pairs into an array of first elements and an array of second elements.
Converts an array of pairs into an array of first elements and an array of second elements.
Type parameters
- A1
-
the type of the first half of the element pairs
- A2
-
the type of the second half of the element pairs
Value parameters
- asPair
-
an implicit conversion which asserts that the element type of this Array is a pair.
- ct1
-
a class tag for
A1type parameter that is required to create an instance ofArray[A1] - ct2
-
a class tag for
A2type parameter that is required to create an instance ofArray[A2]
Attributes
- Returns
-
a pair of Arrays, containing, respectively, the first and second half of each element pair of this Array.
- Source
- Extensions.scala
Converts an array of triples into three arrays, one containing the elements from each position of the triple.
Converts an array of triples into three arrays, one containing the elements from each position of the triple.
Type parameters
- A1
-
the type of the first of three elements in the triple
- A2
-
the type of the second of three elements in the triple
- A3
-
the type of the third of three elements in the triple
Value parameters
- asTriple
-
an implicit conversion which asserts that the element type of this Array is a triple.
- ct1
-
a class tag for T1 type parameter that is required to create an instance of Array[T1]
- ct2
-
a class tag for T2 type parameter that is required to create an instance of Array[T2]
- ct3
-
a class tag for T3 type parameter that is required to create an instance of Array[T3]
Attributes
- Returns
-
a triple of Arrays, containing, respectively, the first, second, and third elements from each element triple of this Array.
- Source
- Extensions.scala
A copy of this array with one single replaced element.
A copy of this array with one single replaced element.
Value parameters
- elem
-
the replacing element
- index
-
the position of the replacement
Attributes
- Returns
-
a new array which is a copy of this array with the element at position
indexreplaced byelem. - Throws
-
IndexOutOfBoundsException
if
indexdoes not satisfy0 <= index < length. - Source
- Extensions.scala
Attributes
- Source
- Extensions.scala
Attributes
- Source
- Extensions.scala
Returns an array formed from this array and another iterable collection by combining corresponding elements in pairs. If one of the two collections is longer than the other, its remaining elements are ignored.
Returns an array formed from this array and another iterable collection by combining corresponding elements in pairs. If one of the two collections is longer than the other, its remaining elements are ignored.
Type parameters
- B
-
the type of the second half of the returned pairs
Value parameters
- that
-
The iterable providing the second half of each result pair
Attributes
- Returns
-
a new array containing pairs consisting of corresponding elements of this array and
that. The length of the returned array is the minimum of the lengths of this array andthat. - Source
- Extensions.scala
Attributes
- Source
- Extensions.scala
Returns an array formed from this array and another iterable collection by combining corresponding elements in pairs. If one of the two collections is shorter than the other, placeholder elements are used to extend the shorter collection to the length of the longer.
Returns an array formed from this array and another iterable collection by combining corresponding elements in pairs. If one of the two collections is shorter than the other, placeholder elements are used to extend the shorter collection to the length of the longer.
Value parameters
- that
-
the iterable providing the second half of each result pair
- thatElem
-
the element to be used to fill up the result if
thatis shorter than this array. - thisElem
-
the element to be used to fill up the result if this array is shorter than
that.
Attributes
- Returns
-
a new array containing pairs consisting of corresponding elements of this array and
that. The length of the returned array is the maximum of the lengths of this array andthat. If this array is shorter thanthat,thisElemvalues are used to pad the result. Ifthatis shorter than this array,thatElemvalues are used to pad the result. - Source
- Extensions.scala
Zips this array with its indices.
Zips this array with its indices.
Attributes
- Returns
-
A new array containing pairs consisting of all elements of this array paired with their index. Indices start at
0. - Source
- Extensions.scala
Attributes
- Source
- Extensions.scala
Attributes
- Source
- Extensions.scala