Golo provides functions to deal with Java arrays (Object[]
).
Array
function takes a variable number of arguments and returns a Java array from them,
aget
function takes an array and an index to return the element at that position,
aset
function takes an array, an index and a value to set the element at that position,
alength
function returns the length of an array,
atoList
function calls the java.util.Arrays.asList(values...)
method.
let a = Array(1, 2, 3) require(alength(a) == 3, "a must be of length 3") require(aget(a, 0) == 1, "the first element shall be 1") aset(a, 0, 666) require(aget(a, 0) == 666, "the new first element shall be 666")
Those functions were introduced for the needs of the early developments of Golo. They will
be removed at some point before the release of version 0, so please use the corresponding array
object methods instead: get
, set
, length
, …