Module : lang.array

Module Overview

This module provides lang library list operations defined by the language specification 2019R2.

Objects

$anonType$2

Functions

enumerate

Returns a new array comprising of position and member pairs.

filter

Returns a new array constructed from those elements of 'arr' for which func returns true.

forEach

Apply function func to each member of array arr.

fromBase16

Returns the byte array that str represents in Base16. str must consist of the characters 0..9, A..F, a..f and whitespace as allowed by a Ballerina Base16Literal.

fromBase64

Returns the byte array that str represents in Base64 encoding. str must consist of the characters A..Z, a..z, 0..9, +, /, = and whitespace as allowed by a Ballerina Base64Literal.

indexOf

Returns the index of first member of arr that is equal to val if there is one. Returns () if not found Equality is tested using ==

iterator

Returns an iterator over the members of arr

length

Returns the number of members contained in arr.

map

Returns a new array applying function func to each member of array arr.

pop

Remove and return the last member of the arr.

push

Add vals to end of the arr array.

reduce

Reduce operate on each member of arr using combining function func to produce a new value combining all members of arr.

remove

Removes the member of arr and index i and returns it. Panics if i is out of range.

removeAll

Removes all members of arr. Panics if any member cannot be removed.

reverse

Reverse the order of the members of arr. Returns arr.

setLength

Increase or decrease the length. setLength(arr, 0) is equivalent to removeAll(arr).

shift

Remove and return first element of the array arr.

slice

Returns a sub array starting from startIndex (inclusive) to endIndex (exclusive).

sort

Sort arr using func to order members. Returns arr.

toBase16

Returns the string representing arr using Base16. The representation is the same as used by a Ballerina Base16Literal. The result will contain only characters 0..9, a..f. There will be no whitespace in the returned string.

toBase64

Returns the string representing arr using Base64 encoding. The representation is the same as used by a Ballerina Base64Literal. The result will contain only characters A..Z, a..z, 0..9, +, / and =. There will be no whitespace in the returned string.

unshift

Add vals to beginig of the array arr.