Skip to content

List

Represents a list of values.

Syntax
\[[expr1, expr2, ..., exprN]\]
Example
[]
[1, 2, 3]

Properties

push

Adds value to the list.

Signature
(value: Any) => Null

pushAll

Adds all values of values to the list.

Signature
(values: List<Any>) => Null

pop

Removes the last element.

Signature
() => Null

clear

Removes all the elements.

Signature
() => Null

length

Returns length of the list.

Signature
() => Number

isEmpty

Is the list empty?

Signature
() => Boolean

isNotEmpty

Is the list not empty?

Signature
() => Boolean

clone

Returns clone of the list.

Signature
() => List<Any>

reversed

Returns reversed clone of the list.

Signature
() => List<Any>

contains

Check if element is present in the list.

Signature
(element: Any) => Boolean

indexOf

Returns the index of element in the list.

Signature
(element: Any) => Boolean

lastIndexOf

Returns the last index of element in the list.

Signature
(element: Any) => Boolean

remove

Removes all element from the list.

Signature
(element: Any) => Boolean

sublist

Returns a sub-list consisting elements between start and end.

Signature
(start: Number, end: Number) => List<Any>

find

Returns the matched element using the predicate.

Signature
(predicate: (element: Any) => Boolean) => Any

findIndex

Returns the index of matched element using the predicate.

Signature
(predicate: (element: Any) => Boolean) => Number

findLastIndex

Returns the last index of matched element using the predicate.

Signature
(predicate: (element: Any) => Boolean) => Number

map

Returns the list of mapped values using predicate.

Signature
(predicate: (element: Any) => Any) => List<Any>

filter

Returns the list of filtered values using predicate.

Signature
(predicate: (element: Any) => Boolean) => List<Any>

sort

Returns the sorted list of using sortBy.

Signature
(sortBy: (a: Any, b: Any) => Number) => List<Any>

flat

Returns the flatted list of level level.

Signature
(level: Number) => List<Any>

flatDeep

Returns the flatted list of level this.length.

Signature
() => List<Any>

unique

Returns the list of unique elements.

Signature
() => List<Any>

forEach

Iterates the list using predicate.

Signature
(predicate: (element: Any) => Null) => Null

join

Returns the elements converted to string, joined by delimiter.

Signature
(delimiter: String) => String