Array
classin packageklyn.collections
public class Array<T> extends Object:
└ Array
Fixed-size contiguous array. This collection stores a fixed number of elements. Unlike `ArrayList<T>`, its length is decided at construction time and cannot change afterwards. The language also exposes the shorthand syntax `T[]` for this type and `T[n]` for array allocation.
import klyn.collections

data as UInt[] = UInt[3]
data[0] = 10u
data[1] = 20u
data[2] = 30u
print(data)          # [10, 20, 30]
print(data.size)     # 3
@param <T> Element type. @since 1.0
Properties
Modifier and Type Member Description
public readonly native property size
size as ULong
Returns the number of elements in the array.
Properties inherited from Object: type
Constructors
Modifier and Type Member Description
public native Array
Array(size as Int)
Creates a new array with a fixed number of elements.
Methods
Modifier and Type Member Description
public join
join(separator as String) as String:
Joins array elements into a single string.
public override toString
toString() as String:
Returns the Python-like textual representation of the array.
Methods inherited from Object: fromJson, toDict, toJson, toString, toXml
Operators
Modifier and Type Member Description
public native operator[](index as Int) as T Returns or replaces the element at the given index.