Arrays

scala.runtime.Arrays
object Arrays

All but the first two operations should be short-circuited and implemented specially by the backend.

Attributes

Source
Arrays.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Arrays.type

Members list

Value members

Concrete methods

def newArray[Arr](componentType: Class[_], returnType: Class[Arr], dimensions: Array[Int]): Arr

Creates an array of a reference type T.

Creates an array of a reference type T.

Type parameters

Arr

the type of the resulting array, which may be multi-dimensional (e.g., Array[Array[Int]])

Value parameters

componentType

the runtime Class of the array's component type

dimensions

the sizes for each dimension of the new array

returnType

the Class representing the return type Arr (unused at runtime, provides type information for the compiler)

Attributes

Returns

the newly created (possibly multi-dimensional) array

Source
Arrays.scala
def newGenericArray[T](length: Int)(implicit tag: ClassTag[T]): Array[T]

Creates an array of some element type determined by the given ClassTag argument. The erased type of applications of this method is Object.

Creates an array of some element type determined by the given ClassTag argument. The erased type of applications of this method is Object.

Type parameters

T

the element type of the array to create

Value parameters

length

the number of elements in the new array

tag

the ClassTag providing the runtime class information for T

Attributes

Returns

the newly created array of type T

Source
Arrays.scala
def seqToArray[T](xs: Seq[T], clazz: Class[_]): Array[T]

Converts a sequence to a Java array with element type given by clazz.

Converts a sequence to a Java array with element type given by clazz.

Type parameters

T

the element type of the sequence and resulting array

Value parameters

clazz

the runtime Class of the element type T

xs

the sequence to convert to an array

Attributes

Returns

a new array containing the elements of xs

Source
Arrays.scala