scala

class Array

[source: scala/Array.scala]

final class Array[A](_length : Int)
extends Vector[A] with TraversableClass[A, Array] with VectorTemplate[A, Array[A]]
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) : Array[A]
Multidimensional array creation
def this (dim1 : Int, dim2 : Int, dim3 : Int, dim4 : Int) : Array[A]
Multidimensional array creation
def this (dim1 : Int, dim2 : Int, dim3 : Int, dim4 : Int, dim5 : Int, dim6 : Int, dim7 : Int) : Array[A]
Multidimensional array creation
def this (dim1 : Int, dim2 : Int, dim3 : Int) : Array[A]
Multidimensional array creation
def this (dim1 : Int, dim2 : Int) : Array[A]
Multidimensional array creation
def this (dim1 : Int, dim2 : Int, dim3 : Int, dim4 : Int, dim5 : Int, dim6 : Int, dim7 : Int, dim8 : Int) : Array[A]
Multidimensional array creation
def this (dim1 : Int, dim2 : Int, dim3 : Int, dim4 : Int, dim5 : Int, dim6 : Int, dim7 : Int, dim8 : Int, dim9 : Int) : Array[A]
Multidimensional array creation
def this (dim1 : Int, dim2 : Int, dim3 : Int, dim4 : Int, dim5 : Int) : Array[A]
Multidimensional array creation
Method Summary
def apply (i : Int) : A
The element at given index.
override def companion : Companion[Array]
The factory companion object that builds instances of class CC
def deepEquals (that : Any) : Boolean
def deepMkString (sep : java.lang.String) : java.lang.String
Returns a string representation of this array object. The string representations of elements (w.r.t. the method deepToString()) are separated by the string sep.
def deepMkString (start : java.lang.String, sep : java.lang.String, end : java.lang.String) : java.lang.String
def deepToString : java.lang.String
def length : Int
The length of the array
def subArray (from : Int, end : Int) : Array[A]
override def update (i : Int, x : A) : Unit
Methods inherited from MutableVectorTemplate
view, view
Methods inherited from VectorTemplate
iterator, isEmpty, foreach, forall, exists, find, foldLeft, foldRight, reduceLeft, reduceRight, zip, zipWithIndex, slice, head, tail, last, init, take, drop, takeRight, dropRight, splitAt, takeWhile, dropWhile, span, sameElements, copyToArray, lengthCompare, segmentLength, indexWhere, lastIndexWhere, reverse, reverseIterator, startsWith, endsWith, equals
Methods inherited from Unhashable
hashCode, identityHashCode
Methods inherited from SequenceTemplate
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 PartialFunction
orElse, andThen
Methods inherited from Function1
compose
Methods inherited from IterableTemplate
elements, toIterable, toStream, first, firstOption, toSeq
Methods inherited from TraversableClass
newBuilder, genericBuilder, unzip, flatten, transpose
Methods inherited from TraversableTemplate
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, clone, 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[A]
Multidimensional array creation

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

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

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

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

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

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

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

def this(dim1 : Int, dim2 : Int, dim3 : Int, dim4 : Int, dim5 : Int, dim6 : Int) : Array[A]
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[A]
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[A]
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[A]
Multidimensional array creation

Method Details
override def companion : Companion[Array]
The factory companion object that builds instances of class CC
Overrides
Vector.companion, TraversableClass.companion

def length : Int
The length of the array

def apply(i : Int) : A
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

override def update(i : Int, x : A) : 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

def deepToString : java.lang.String
Returns
a deep string representation of this array.

def deepMkString(start : java.lang.String, sep : java.lang.String, end : java.lang.String) : java.lang.String

Returns a string representation of this array object. The resulting string begins with the string start and is finished by the string end. Inside, the string representations of elements (w.r.t. the method deepToString()) are separated by the string sep. For example:

Array(Array(1, 2), Array(3)).deepMkString("[", "; ", "]") = "[[1; 2]; [3]]"

Parameters
start - starting string.
sep - separator string.
end - ending string.
Returns
a string representation of this array object.

def deepMkString(sep : java.lang.String) : java.lang.String
Returns a string representation of this array object. The string representations of elements (w.r.t. the method deepToString()) are separated by the string sep.
Parameters
sep - separator string.
Returns
a string representation of this array object.

def deepEquals(that : Any) : Boolean

Returns true if the two specified arrays are deeply equal to one another.

Two array references are considered deeply equal if both are null, or if they refer to arrays that contain the same number of elements and all corresponding pairs of elements in the two arrays are deeply equal.

See also method deepEquals in the Java class java.utils.Arrays

Parameters
that - the second
Returns
true iff both arrays are deeply equal.

@deprecated("use `slice' instead")

def subArray(from : Int, end : Int) : Array[A]