Skip to main content
Version: 8.5

List functions

list contains(list, element)

Returns true if the given list contains the element. Otherwise, returns false.

Function signature

list contains(list: list, element: Any): boolean

Examples

list contains([1,2,3], 2)
// true

count(list)

Returns the number of elements of the given list.

Function signature

count(list: list): number

Examples

count([1,2,3])
// 3

min(list)

Returns the minimum of the given list.

Function signature

min(list: list): Any

All elements in list should have the same type and be comparable.

The parameter list can be passed as a list or as a sequence of elements.

Examples

min([1,2,3])
// 1

min(1,2,3)
// 1

max(list)

Returns the maximum of the given list.

Function signature

max(list: list): Any

All elements in list should have the same type and be comparable.

The parameter list can be passed as a list or as a sequence of elements.

Examples

max([1,2,3])
// 3

max(1,2,3)
// 3

sum(list)

Returns the sum of the given list of numbers.

Function signature

sum(list: list<number>): number

The parameter list can be passed as a list or as a sequence of elements.

Examples

sum([1,2,3])
// 6

sum(1,2,3)
// 6

product(list)

Returns the product of the given list of numbers.

Function signature

product(list: list<number>): number

The parameter list can be passed as a list or as a sequence of elements.

Examples

product([2, 3, 4])
// 24

product(2, 3, 4)
// 24

mean(list)

Returns the arithmetic mean (i.e. average) of the given list of numbers.

Function signature

mean(list: list<number>): number

The parameter list can be passed as a list or as a sequence of elements.

Examples

mean([1,2,3])
// 2

mean(1,2,3)
// 2

median(list)

Returns the median element of the given list of numbers.

Function signature

median(list: list<number>): number

The parameter list can be passed as a list or as a sequence of elements.

Examples

median(8, 2, 5, 3, 4)
// 4

median([6, 1, 2, 3])
// 2.5

stddev(list)

Returns the standard deviation of the given list of numbers.

Function signature

stddev(list: list<number>): number

The parameter list can be passed as a list or as a sequence of elements.

Examples

stddev(2, 4, 7, 5)
// 2.0816659994661326

stddev([2, 4, 7, 5])
// 2.0816659994661326

mode(list)

Returns the mode of the given list of numbers.

Function signature

mode(list: list<number>): number

The parameter list can be passed as a list or as a sequence of elements.

Examples

mode(6, 3, 9, 6, 6)
// [6]

mode([6, 1, 9, 6, 1])
// [1, 6]

all(list)

Returns false if any element of the given list is false. Otherwise, returns true.

If the given list is empty, it returns true.

Function signature

all(list: list<boolean>): boolean

The parameter list can be passed as a list or as a sequence of elements.

Examples

all([true,false])
// false

all(false,null,true)
// false
info

The function all() replaced the previous function and(). The previous function is deprecated and should not be used anymore.

any(list)

Returns true if any element of the given list is true. Otherwise, returns false.

If the given list is empty, it returns false.

Function signature

any(list: list<boolean>): boolean

The parameter list can be passed as a list or as a sequence of elements.

Examples

any([false,true])
// true

any(false,null,true)
// true
info

The function any() replaced the previous function or(). The previous function is deprecated and should not be used anymore.

sublist(list, start position)

Returns a partial list of the given value starting at start position.

Function signature

sublist(list: list, start position: number): list

The start position starts at the index 1. The last position is -1.

Examples

sublist([1,2,3], 2)
// [2,3]

sublist(list, start position, length)

Returns a partial list of the given value starting at start position.

Function signature

sublist(list: list, start position: number, length: number): list

The start position starts at the index 1. The last position is -1.

Examples

sublist([1,2,3], 1, 2)
// [1,2]

append(list, items)

Returns the given list with all items appended.

Function signature

append(list: list, items: Any): list

The parameter items can be a single element or a sequence of elements.

Examples

append([1], 2, 3)
// [1,2,3]

concatenate(lists)

Returns a list that includes all elements of the given lists.

Function signature

concatenate(lists: list): list

The parameter lists is a sequence of lists.

Examples

concatenate([1,2],[3])
// [1,2,3]

concatenate([1],[2],[3])
// [1,2,3]

insert before(list, position, newItem)

Returns the given list with newItem inserted at position.

Function signature

insert before(list: list, position: number, newItem: Any): list

The position starts at the index 1. The last position is -1.

Examples

insert before([1,3],1,2)
// [2,1,3]

remove(list, position)

Returns the given list without the element at position.

Function signature

remove(list: list, position: number): list

The position starts at the index 1. The last position is -1.

Examples

remove([1,2,3], 2)
// [1,3]

reverse(list)

Returns the given list in revered order.

Function signature

reverse(list: list): list

Examples

reverse([1,2,3])
// [3,2,1]

index of(list, match)

Returns an ascending list of positions containing match.

Function signature

index of(list: list, match: Any): list<number>

Examples

index of([1,2,3,2],2)
// [2,4]

union(list)

Returns a list that includes all elements of the given lists without duplicates.

Function signature

union(list: list): list

The parameter list is a sequence of lists.

Examples

union([1,2],[2,3])
// [1,2,3]

distinct values(list)

Returns the given list without duplicates.

Function signature

distinct values(list: list): list

Examples

distinct values([1,2,3,2,1])
// [1,2,3]

duplicate values(list)

Camunda Extension

Returns all duplicate values of the given list.

Function signature

duplicate values(list: list): list

Examples

duplicate values([1,2,3,2,1])
// [1,2]

flatten(list)

Returns a list that includes all elements of the given list without nested lists.

Function signature

flatten(list: list): list

Examples

flatten([[1,2],[[3]], 4])
// [1,2,3,4]

sort(list, precedes)

Returns the given list sorted by the precedes function.

Function signature

sort(list: list, precedes: function<(Any, Any) -> boolean>): list

Examples

sort(list: [3,1,4,5,2], precedes: function(x,y) x < y)
// [1,2,3,4,5]

string join(list)

Joins a list of strings into a single string. This is similar to Java's joining function.

If an item of the list is null, the item is ignored for the result string. If an item is neither a string nor null, the function returns null instead of a string.

Function signature

string join(list: list<string>): string

Examples

string join(["a","b","c"])
// "abc"

string join(["a",null,"c"])
// "ac"

string join([])
// ""

string join(list, delimiter)

Joins a list of strings into a single string. This is similar to Java's joining function.

If an item of the list is null, the item is ignored for the result string. If an item is neither a string nor null, the function returns null instead of a string.

The resulting string contains a delimiter between each element.

Function signature

string join(list: list<string>, delimiter: string): string

Examples

string join(["a"], "X")
// "a"

string join(["a","b","c"], ", ")
// "a, b, c"

string join(list, delimiter, prefix, suffix)

Camunda Extension

Joins a list of strings into a single string. This is similar to Java's joining function.

If an item of the list is null, the item is ignored for the result string. If an item is neither a string nor null, the function returns null instead of a string.

The resulting string starts with prefix, contains a delimiter between each element, and ends with suffix.

Function signature

string join(list: list<string>, delimiter: string, prefix: string, suffix: string): string

Examples

string join(["a","b","c"], ", ", "[", "]")
// "[a, b, c]"