IArray

object IArray

An immutable array. An IArray[T] has the same representation as an Array[T], but it cannot be updated. Unlike regular arrays, immutable arrays are covariant.

class Object
trait Matchable
class Any

Type members

Classlikes

class WithFilter[T](p: T => Boolean, xs: IArray[T])

A lazy filtered array. No filtering is applied until one of foreach, map or flatMap is called.

Value members

Concrete methods

def apply[T](xs: T*)(using ct: ClassTag[T]): IArray[T]

An immutable array with given elements.

An immutable array with given elements.

def apply(x: Byte, xs: Byte*): IArray[Byte]

An immutable array with given elements.

def apply(x: Short, xs: Short*): IArray[Short]

An immutable array with given elements.

def apply(x: Char, xs: Char*): IArray[Char]

An immutable array with given elements.

def apply(x: Int, xs: Int*): IArray[Int]

An immutable array with given elements.

def apply(x: Long, xs: Long*): IArray[Long]

An immutable array with given elements.

def apply(x: Float, xs: Float*): IArray[Float]

An immutable array with given elements.

def apply(x: Double, xs: Double*): IArray[Double]

An immutable array with given elements.

def apply(x: Unit, xs: Unit*): IArray[Unit]

An immutable array with given elements.

def concat[T](xss: IArray[T]*)(`evidence$30`: ClassTag[T]): IArray[T]

Concatenates all arrays into a single immutable array.

Value Params
xss

the given immutable arrays

Returns

the array created from concatenating xss

def empty[T](`evidence$28`: ClassTag[T]): IArray[T]

An immutable array of length 0.

An immutable boolean array of length 0.

An immutable byte array of length 0.

An immutable char array of length 0.

An immutable double array of length 0.

An immutable float array of length 0.

An immutable int array of length 0.

An immutable long array of length 0.

An immutable object array of length 0.

An immutable short array of length 0.

def equals(xs: IArray[AnyRef], ys: IArray[AnyRef]): Boolean

Compare two arrays per element.

A more efficient version of xs.sameElements(ys).

Value Params
xs

an array of AnyRef

ys

an array of AnyRef

Returns

true if corresponding elements are equal

def fill[T](n: Int)(elem: => T)(`evidence$31`: ClassTag[T]): IArray[T]

Returns an immutable array that contains the results of some element computation a number of times. Each element is determined by a separate computation.

Value Params
elem

the element computation

n

the number of elements in the array

def fill[T](n1: Int, n2: Int)(elem: => T)(`evidence$32`: ClassTag[T]): IArray[IArray[T]]

Returns a two-dimensional immutable array that contains the results of some element computation a number of times. Each element is determined by a separate computation.

Value Params
elem

the element computation

n1

the number of elements in the 1st dimension

n2

the number of elements in the 2nd dimension

def fill[T](n1: Int, n2: Int, n3: Int)(elem: => T)(`evidence$33`: ClassTag[T]): IArray[IArray[IArray[T]]]

Returns a three-dimensional immutable array that contains the results of some element computation a number of times. Each element is determined by a separate computation.

Value Params
elem

the element computation

n1

the number of elements in the 1st dimension

n2

the number of elements in the 2nd dimension

n3

the number of elements in the 3nd dimension

def fill[T](n1: Int, n2: Int, n3: Int, n4: Int)(elem: => T)(`evidence$34`: ClassTag[T]): IArray[IArray[IArray[IArray[T]]]]

Returns a four-dimensional immutable array that contains the results of some element computation a number of times. Each element is determined by a separate computation.

Value Params
elem

the element computation

n1

the number of elements in the 1st dimension

n2

the number of elements in the 2nd dimension

n3

the number of elements in the 3nd dimension

n4

the number of elements in the 4th dimension

def fill[T](n1: Int, n2: Int, n3: Int, n4: Int, n5: Int)(elem: => T)(`evidence$35`: ClassTag[T]): IArray[IArray[IArray[IArray[IArray[T]]]]]

Returns a five-dimensional immutable array that contains the results of some element computation a number of times. Each element is determined by a separate computation.

Value Params
elem

the element computation

n1

the number of elements in the 1st dimension

n2

the number of elements in the 2nd dimension

n3

the number of elements in the 3nd dimension

n4

the number of elements in the 4th dimension

n5

the number of elements in the 5th dimension

def from[A](it: IterableOnce[A])(`evidence$29`: ClassTag[A]): IArray[A]

Build an array from the iterable collection.

scala> val a = IArray.from(Seq(1, 5)) val a: IArray[Int] = IArray(1, 5) scala> val b = IArray.from(Range(1, 5)) val b: IArray[Int] = IArray(1, 2, 3, 4)
Value Params
it

the iterable collection

Returns

an array consisting of elements of the iterable collection

def iterate[T](start: T, len: Int)(f: T => T)(`evidence$41`: ClassTag[T]): IArray[T]

Returns an immutable array containing repeated applications of a function to a start value.

Value Params
f

the function that is repeatedly applied

len

the number of elements returned by the array

start

the start value of the array

Returns

the immutable array returning len values in the sequence start, f(start), f(f(start)), ...

def newBuilder[T](using t: ClassTag[T]): Builder[T, IArray[T]]
def range(start: Int, end: Int): IArray[Int]

Returns an immutable array containing a sequence of increasing integers in a range.

Value Params
end

the end value of the array, exclusive (in other words, this is the first value not returned)

start

the start value of the array

Returns

the immutable array with values in range start, start + 1, ..., end - 1 up to, but excluding, end.

def range(start: Int, end: Int, step: Int): IArray[Int]

Returns an immutable array containing equally spaced values in some integer interval.

Value Params
end

the end value of the array, exclusive (in other words, this is the first value not returned)

start

the start value of the array

step

the increment value of the array (may not be zero)

Returns

the immutable array with values in start, start + step, ... up to, but excluding end

def tabulate[T](n: Int)(f: Int => T)(`evidence$36`: ClassTag[T]): IArray[T]

Returns an immutable array containing values of a given function over a range of integer values starting from 0.

Value Params
f

The function computing element values

n

The number of elements in the array

def tabulate[T](n1: Int, n2: Int)(f: (Int, Int) => T)(`evidence$37`: ClassTag[T]): IArray[IArray[T]]

Returns a two-dimensional immutable array containing values of a given function over ranges of integer values starting from 0.

Value Params
f

The function computing element values

n1

the number of elements in the 1st dimension

n2

the number of elements in the 2nd dimension

def tabulate[T](n1: Int, n2: Int, n3: Int)(f: (Int, Int, Int) => T)(`evidence$38`: ClassTag[T]): IArray[IArray[IArray[T]]]

Returns a three-dimensional immutable array containing values of a given function over ranges of integer values starting from 0.

Value Params
f

The function computing element values

n1

the number of elements in the 1st dimension

n2

the number of elements in the 2nd dimension

n3

the number of elements in the 3rd dimension

def tabulate[T](n1: Int, n2: Int, n3: Int, n4: Int)(f: (Int, Int, Int, Int) => T)(`evidence$39`: ClassTag[T]): IArray[IArray[IArray[IArray[T]]]]

Returns a four-dimensional immutable array containing values of a given function over ranges of integer values starting from 0.

Value Params
f

The function computing element values

n1

the number of elements in the 1st dimension

n2

the number of elements in the 2nd dimension

n3

the number of elements in the 3rd dimension

n4

the number of elements in the 4th dimension

def tabulate[T](n1: Int, n2: Int, n3: Int, n4: Int, n5: Int)(f: (Int, Int, Int, Int, Int) => T)(`evidence$40`: ClassTag[T]): IArray[IArray[IArray[IArray[IArray[T]]]]]

Returns a five-dimensional immutable array containing values of a given function over ranges of integer values starting from 0.

Value Params
f

The function computing element values

n1

the number of elements in the 1st dimension

n2

the number of elements in the 2nd dimension

n3

the number of elements in the 3rd dimension

n4

the number of elements in the 4th dimension

n5

the number of elements in the 5th dimension

def unapplySeq[T](x: IArray[T]): UnapplySeqWrapper[_ <: T]

Returns a decomposition of the array into a sequence. This supports a pattern match like { case IArray(x,y,z) => println('3 elements')}.

Value Params
x

the selector value

Returns

sequence wrapped in a scala.Some, if x is a Seq, otherwise None

def unsafeFromArray[T](s: Array[T]): IArray[T]

Convert an array into an immutable array without copying, the original array must _not_ be mutated after this or the guaranteed immutablity of IArray will be violated.

Extensions

Extensions

extension (arr: IArray[T])
def map[T](f: T => U)(`evidence$2`: ClassTag[U]): IArray[U]

Builds a new array by applying a function to all elements of this array.

extension (arr: IArray[T])
def flatten[T](using asIterable: T => Iterable[U], ct: ClassTag[U]): IArray[U]

Flattens a two-dimensional array by concatenating all its rows into a single array.

extension (arr: IArray[T])
def fold[T](z: U)(op: (U, U) => U): U

Folds the elements of this array using the specified associative binary operator.

extension (arr: IArray[T])
def apply[T](n: Int): T
extension (arr: IArray[T])
def headOption[T]: Option[T]

Optionally selects the first element.

extension (arr: IArray[T])
def sortBy[T](f: T => U)(using Ordering[U]): IArray[T]

Sorts this array according to the Ordering which results from transforming an implicitly given Ordering with a transformation function.

extension (arr: IArray[T])
def takeRight[T](n: Int): IArray[T]

An array containing the last n elements of this array.

extension (arr: IArray[T])
def indexOf[T](elem: T, from: Int): Int

Finds index of first occurrence of some value in this array after or at some start index.

extension (arr: IArray[T])
def toArray[T]: Array[T]

Returns a mutable copy of this immutable array.

extension (arr: IArray[T])
def iterator[T]: Iterator[T]

An iterator yielding the elemenst of this array.

extension (arr: IArray[T])
def find[T](p: T => Boolean): Option[T]

Finds the first element of the array satisfying a predicate, if any.

extension (arr: IArray[T])
def lastIndexWhere[T](p: T => Boolean, end: Int): Int

Finds index of last element satisfying some predicate before or at given end index.

extension (arr: IArray[T])
def count[T](p: T => Boolean): Int

Counts the number of elements in this array which satisfy a predicate

extension (arr: IArray[T])
def reverse[T]: IArray[T]

Returns a new array with the elements in reversed order.

extension (arr: IArray[T])
def exists[T](p: T => Boolean): Boolean

Tests whether a predicate holds for at least one element of this array.

extension (arr: IArray[T])
def tail[T]: IArray[T]

The rest of the array without its first element.

extension (arr: IArray[T])
def scanLeft[T](z: U)(op: (U, T) => U)(`evidence$4`: ClassTag[U]): IArray[U]

Produces an array containing cumulative results of applying the binary operator going left to right.

extension (arr: IArray[Float])
def apply(n: Int): Float
extension (arr: IArray[T])
def indexWhere[T](p: T => Boolean, from: Int): Int

Finds index of the first element satisfying some predicate after or at some start index.

extension (arr: IArray[T])
def length[T]: Int
extension (arr: IArray[T])
def nonEmpty[T]: Boolean

Tests whether the array is not empty.

extension (arr: IArray[T])
def copyToArray[T](xs: Array[U], start: Int): Int

Copy elements of this array to another array.

extension (arr: IArray[T])
def foreach[T](f: T => U): Unit

Apply f to each element for its side effects.

extension (arr: IArray[T])
def scan[T](z: U)(op: (U, U) => U)(`evidence$3`: ClassTag[U]): IArray[U]

Computes a prefix scan of the elements of the array.

extension (arr: IArray[T])
def contains[T](elem: T): Boolean

Tests whether this array contains a given value as an element.

extension (arr: IArray[Int])
def apply(n: Int): Int
extension (arr: IArray[Short])
def length: Int
extension (arr: IArray[T])
def indices[T]: Range

Produces the range of all indices of this sequence.

extension (arr: IArray[T])
def size[T]: Int

The size of this array.

extension (arr: IArray[T])
def copyToArray[T](xs: Array[U], start: Int, len: Int): Int

Copy elements of this array to another array.

extension (arr: IArray[T])
def scanRight[T](z: U)(op: (T, U) => U)(`evidence$5`: ClassTag[U]): IArray[U]

Produces an array containing cumulative results of applying the binary operator going right to left.

extension (arr: IArray[T])
def partition[T](p: T => Boolean): (IArray[T], IArray[T])

A pair of, first, all elements that satisfy predicate p and, second, all elements that do not.

extension (arr: IArray[Double])
def apply(n: Int): Double
extension (arr: IArray[T])
def copyToArray[T](xs: Array[U]): Int

Copy elements of this array to another array.

extension (arr: IArray[T])
def foldRight[T](z: U)(op: (T, U) => U): U

Applies a binary operator to all elements of this array and a start value, going right to left.

extension (arr: IArray[T])
def take[T](n: Int): IArray[T]

An array containing the first n elements of this array.

extension (arr: IArray[Short])
def apply(n: Int): Short
extension (arr: IArray[Object])
def length: Int
extension (arr: IArray[Double])
def length: Int
extension (arr: IArray[T])
def isEmpty[T]: Boolean

Tests whether the array is empty.

extension (arr: IArray[T])
def ++[T](suffix: IArray[U])(`evidence$6`: ClassTag[U]): IArray[U]
def ++[T](suffix: IterableOnce[U])(`evidence$7`: ClassTag[U]): IArray[U]
def :+[T](x: U)(`evidence$8`: ClassTag[U]): IArray[U]
def :++[T](suffix: IArray[U])(`evidence$9`: ClassTag[U]): IArray[U]
def :++[T](suffix: IterableOnce[U])(`evidence$10`: ClassTag[U]): IArray[U]
def appended[T](x: U)(`evidence$11`: ClassTag[U]): IArray[U]
def appendedAll[T](suffix: IArray[U])(`evidence$12`: ClassTag[U]): IArray[U]
def appendedAll[T](suffix: IterableOnce[U])(`evidence$13`: ClassTag[U]): IArray[U]
def collect[T](pf: PartialFunction[T, U])(`evidence$14`: ClassTag[U]): IArray[U]
def collectFirst[T](f: PartialFunction[T, U]): Option[U]
def combinations[T](n: Int): Iterator[IArray[T]]
def concat[T](suffix: IArray[U])(`evidence$15`: ClassTag[U]): IArray[U]
def concat[T](suffix: IterableOnce[U])(`evidence$16`: ClassTag[U]): IArray[U]
def diff[T](that: IArray[U]): IArray[T]
def diff[T](that: Seq[U]): IArray[T]
def distinct[T]: IArray[T]
def distinctBy[T](f: T => U): IArray[T]
def endsWith[T](that: IArray[U]): Boolean
def endsWith[T](that: Iterable[U]): Boolean
def groupBy[T](f: T => K): Map[K, IArray[T]]
def groupMap[T](key: T => K)(f: T => U)(`evidence$17`: ClassTag[U]): Map[K, IArray[U]]
def grouped[T](size: Int): Iterator[IArray[T]]
def inits[T]: Iterator[IArray[T]]
def intersect[T](that: IArray[U]): IArray[T]
def intersect[T](that: Seq[U]): IArray[T]
def lazyZip[T](that: IArray[U]): LazyZip2[T, U, IArray[T]]
def lazyZip[T](that: Iterable[U]): LazyZip2[T, U, IArray[T]]
def lengthCompare[T](len: Int): Int
def padTo[T](len: Int, elem: U)(`evidence$18`: ClassTag[U]): IArray[U]
def partitionMap[T](f: T => Either[T1, T2])(`evidence$19`: ClassTag[T1], `evidence$20`: ClassTag[T2]): (IArray[T1], IArray[T2])
def patch[T](from: Int, other: IterableOnce[U], replaced: Int)(`evidence$21`: ClassTag[U]): IArray[U]
def prepended[T](x: U)(`evidence$22`: ClassTag[U]): IArray[U]
def prependedAll[T](prefix: IterableOnce[U])(`evidence$23`: ClassTag[U]): IArray[U]
def search[T](elem: U)(using Ordering[U]): SearchResult
def search[T](elem: U, from: Int, to: Int)(using Ordering[U]): SearchResult
def sizeCompare[T](that: IArray[Any]): Int
def sizeCompare[T](that: Iterable[_]): Int
def sizeCompare[T](otherSize: Int): Int
def sliding[T](size: Int, step: Int): Iterator[IArray[T]]
def startsWith[T](that: IArray[U]): Boolean
def startsWith[T](that: IArray[U], offset: Int): Boolean
def startsWith[T](that: IterableOnce[U]): Boolean
def startsWith[T](that: IterableOnce[U], offset: Int): Boolean
def stepper[T](using StepperShape[T, S]): S
def tails[T]: Iterator[IArray[T]]
def tapEach[T](f: T => U): IArray[T]
def transpose[T](asArray: T => IArray[U]): IArray[IArray[U]]
def unzip[T](using asPair: T => (T1, T2), ct1: ClassTag[T1], ct2: ClassTag[T2]): (IArray[T1], IArray[T2])
def unzip3[T](using asTriple: T => (T1, T2, T3), ct1: ClassTag[T1], ct2: ClassTag[T2], ct3: ClassTag[T3]): (IArray[T1], IArray[T2], IArray[T3])
def updated[T](index: Int, elem: U)(`evidence$24`: ClassTag[U]): IArray[U]
def view[T]: SeqView[T]
def withFilter[T](p: T => Boolean): WithFilter[T]
def zip[T](that: IArray[U]): IArray[(T, U)]
def zip[T](that: IterableOnce[U]): IArray[(T, U)]
def zipAll[T](that: IArray[U], thisElem: T1, thatElem: U): IArray[(T1, U)]
def zipAll[T](that: Iterable[U], thisElem: T1, thatElem: U): IArray[(T1, U)]
def zipWithIndex[T]: IArray[(T, Int)]
extension (arr: IArray[Float])
def length: Int
extension (arr: IArray[T])
def last[T]: T

Selects the last element.

extension (arr: IArray[Long])
def length: Int
extension (arr: IArray[Long])
def apply(n: Int): Long
extension (arr: IArray[T])
def lastOption[T]: Option[T]

Optionally selects the last element.

extension (arr: IArray[T])
def drop[T](n: Int): IArray[T]

The rest of the array without its n first elements.

extension (arr: IArray[Byte])
def length: Int

The number of elements in an immutable array

Value Params
arr

the immutable array

extension (arr: IArray[T])
def forall[T](p: T => Boolean): Boolean

Tests whether a predicate holds for all elements of this array.

extension (arr: IArray[T])
def span[T](p: T => Boolean): (IArray[T], IArray[T])

Splits this array into a prefix/suffix pair according to a predicate.

extension (arr: IArray[T])
def filterNot[T](p: T => Boolean): IArray[T]

Selects all elements of this array which do not satisfy a predicate.

extension (arr: IArray[T])
def flatMap[T](f: T => IterableOnce[U])(`evidence$1`: ClassTag[U]): IArray[U]

Builds a new array by applying a function to all elements of this array and using the elements of the resulting collections.

extension (arr: IArray[T])
def init[T]: IArray[T]

The initial part of the array without its last element.

extension (arr: IArray[T])
def filter[T](p: T => Boolean): IArray[T]

Selects all elements of this array which satisfy a predicate.

extension (arr: IArray[T])
def lastIndexOf[T](elem: T, end: Int): Int

Finds index of last occurrence of some value in this array before or at a given end index.

extension (arr: IArray[Char])
def apply(n: Int): Char
extension (arr: IArray[T])
def foldLeft[T](z: U)(op: (U, T) => U): U

Applies a binary operator to a start value and all elements of this array, going left to right.

extension (arr: IArray[T])
def sortWith[T](f: (T, T) => Boolean): IArray[T]

Sorts this array according to a comparison function.

extension (arr: IArray[T])
def dropRight[T](n: Int): IArray[T]

The rest of the array without its n last elements.

extension (arr: IArray[T])
def head[T]: T

Selects the first element of this array.

extension (arr: IArray[T])
def sorted[T](using Ordering[T]): IArray[T]

Sorts this array according to an Ordering.

extension (arr: IArray[T])
def splitAt[T](n: Int): (IArray[T], IArray[T])

Splits this array into two at a given position.

extension (arr: IArray[T])
def takeWhile[T](p: T => Boolean): IArray[T]

Takes longest prefix of elements that satisfy a predicate.

extension (arr: IArray[T])
def dropWhile[T](p: T => Boolean): IArray[T]

Drops longest prefix of elements that satisfy a predicate.

extension (arr: IArray[Char])
def length: Int
extension (arr: IArray[Int])
def length: Int
extension (arr: IArray[T])
def slice[T](from: Int, until: Int): IArray[T]

Selects the interval of elements between the given indices.

extension (arr: IArray[T])
def apply[T <: Object](n: Int): T
extension (arr: IArray[Byte])
def apply(n: Int): Byte

The selection operation on an immutable array.

Value Params
arr

the immutable array

n

the index of the element to select

Returns

the element of the array at the given index

extension (prefix: IArray[T])
def ++:[T, U >: T](arr: IArray[U])(`evidence$26`: ClassTag[U]): IArray[U]
extension (prefix: IterableOnce[T])
def ++:[T, U >: T](arr: IArray[U])(`evidence$25`: ClassTag[U]): IArray[U]
extension (x: T)
def +:[T, U >: T](arr: IArray[U])(`evidence$27`: ClassTag[U]): IArray[U]

Implicits

Implicits

implicit def genericWrapArray[T](arr: IArray[T]): ArraySeq[T]

Conversion from IArray to immutable.ArraySeq

Conversion from IArray to immutable.ArraySeq

implicit def wrapByteIArray(arr: IArray[Byte]): ofByte

Conversion from IArray to immutable.ArraySeq

implicit def wrapCharIArray(arr: IArray[Char]): ofChar

Conversion from IArray to immutable.ArraySeq

implicit def wrapDoubleIArray(arr: IArray[Double]): ofDouble

Conversion from IArray to immutable.ArraySeq

implicit def wrapFloatIArray(arr: IArray[Float]): ofFloat

Conversion from IArray to immutable.ArraySeq

implicit def wrapIntArray(arr: IArray[Int]): ofInt

Conversion from IArray to immutable.ArraySeq

implicit def wrapLongIArray(arr: IArray[Long]): ofLong

Conversion from IArray to immutable.ArraySeq

implicit def wrapRefArray[T <: AnyRef](arr: IArray[T]): ofRef[T]

Conversion from IArray to immutable.ArraySeq

implicit def wrapShortIArray(arr: IArray[Short]): ofShort

Conversion from IArray to immutable.ArraySeq

implicit def wrapUnitIArray(arr: IArray[Unit]): ofUnit

Conversion from IArray to immutable.ArraySeq