scala

class Array

[source: scala/Array.scala]

final class Array[T](_length : Int)
extends AnyRef
This class represents polymorphic arrays. Array[T] is Scala's representation for Java's T[].
Author
Martin Odersky
Version
1.0
Additional Constructor Summary
def this (dim1 : Int, dim2 : Int, dim3 : Int, dim4 : Int, dim5 : Int, dim6 : Int, dim7 : Int) : Array[T]
Multidimensional array creation
def this (dim1 : Int, dim2 : Int, dim3 : Int, dim4 : Int) : Array[T]
Multidimensional array creation
def this (dim1 : Int, dim2 : Int, dim3 : Int, dim4 : Int, dim5 : Int, dim6 : Int, dim7 : Int, dim8 : Int, dim9 : Int) : Array[T]
Multidimensional array creation
def this (dim1 : Int, dim2 : Int, dim3 : Int, dim4 : Int, dim5 : Int) : Array[T]
Multidimensional array creation
def this (dim1 : Int, dim2 : Int) : Array[T]
Multidimensional array creation
def this (dim1 : Int, dim2 : Int, dim3 : Int, dim4 : Int, dim5 : Int, dim6 : Int) : Array[T]
Multidimensional array creation
def this (dim1 : Int, dim2 : Int, dim3 : Int) : Array[T]
Multidimensional array creation
def this (dim1 : Int, dim2 : Int, dim3 : Int, dim4 : Int, dim5 : Int, dim6 : Int, dim7 : Int, dim8 : Int) : Array[T]
Multidimensional array creation
Method Summary
def apply (i : Int) : T
The element at given index.
def length : Int
The length of the array
def update (i : Int, x : T) : Unit
Methods inherited from AnyRef
getClass, hashCode, equals, clone, toString, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized
Methods inherited from Any
==, !=, isInstanceOf, asInstanceOf
Additional Constructor Details
@deprecated("use `Array.ofDim' instead")

def this(dim1 : Int, dim2 : Int) : Array[T]
Multidimensional array creation

@deprecated("use `Array.ofDim' instead")

def this(dim1 : Int, dim2 : Int, dim3 : Int) : Array[T]
Multidimensional array creation

@deprecated("use `Array.ofDim' instead")

def this(dim1 : Int, dim2 : Int, dim3 : Int, dim4 : Int) : Array[T]
Multidimensional array creation

@deprecated("use `Array.ofDim' instead")

def this(dim1 : Int, dim2 : Int, dim3 : Int, dim4 : Int, dim5 : Int) : Array[T]
Multidimensional array creation

@deprecated("use `Array.ofDim' instead")

def this(dim1 : Int, dim2 : Int, dim3 : Int, dim4 : Int, dim5 : Int, dim6 : Int) : Array[T]
Multidimensional array creation

@deprecated("use `Array.ofDim' instead")

def this(dim1 : Int, dim2 : Int, dim3 : Int, dim4 : Int, dim5 : Int, dim6 : Int, dim7 : Int) : Array[T]
Multidimensional array creation

@deprecated("use `Array.ofDim' instead")

def this(dim1 : Int, dim2 : Int, dim3 : Int, dim4 : Int, dim5 : Int, dim6 : Int, dim7 : Int, dim8 : Int) : Array[T]
Multidimensional array creation

@deprecated("use `Array.ofDim' instead")

def this(dim1 : Int, dim2 : Int, dim3 : Int, dim4 : Int, dim5 : Int, dim6 : Int, dim7 : Int, dim8 : Int, dim9 : Int) : Array[T]
Multidimensional array creation

Method Details
def length : Int
The length of the array

def apply(i : Int) : T
The element at given index.

Indices start a 0; xs.apply(0) is the first element of array xs.

Note the indexing syntax xs(i) is a shorthand for xs.apply(i).

Parameters
i - the index
Throws
ArrayIndexOutOfBoundsException - if i < 0 or length <= i

def update(i : Int, x : T) : Unit

Update the element at given index.

Indices start a 0; xs.apply(0) is the first element of array xs.

Note the indexing syntax xs(i) = x is a shorthand for xs.update(i, x).

Parameters
i - the index
x - the value to be written at index i
Throws
ArrayIndexOutOfBoundsException - if i < 0 or length <= i