apoc.coll.pairWithOffset

Function

apoc.coll.pairWithOffset(coll LIST<ANY>, offset INTEGER) - returns a LIST<ANY> of pairs defined by the offset.

Signature

apoc.coll.pairWithOffset(values :: LIST<ANY>, offset :: INTEGER) :: LIST<ANY>

Input parameters

Name Type Default

values

LIST<ANY>

null

offset

INTEGER

null

Usage examples

The following returns a list of pairs defined by the offset:

RETURN apoc.coll.pairWithOffset([1,2,3,4], 2) AS value
Table 1. Results
value

[[1,3],[2,4],[3,null],[4,null]]

It works also as procedure:

CALL apoc.coll.pairWithOffset([1,2,3,4], 2)
Table 2. Results
value

[1,3]

[2,4]

[3,null]

[4,null]