apoc.coll.set

Function

apoc.coll.set(coll LIST<ANY>, index INTEGER, value ANY) - sets the element at the given index to the new value.

Signature

apoc.coll.set(coll :: LIST<ANY>, index :: INTEGER, value :: ANY) :: LIST<ANY>

Input parameters

Name Type Default

coll

LIST<ANY>

null

index

INTEGER

null

value

ANY

null

Usage examples

The following replaces the item at index 4 with the value 11:

RETURN apoc.coll.set([1,3,5,7,9], 4, 11) AS output;
Table 1. Results
Output

[1, 3, 5, 7, 11]