apoc.coll.pairWithOffset

Details

Syntax

apoc.coll.pairWithOffset(coll, offset)

Description

Returns a LIST<ANY> of pairs defined by the offset.

Arguments

Name

Type

Description

coll

LIST<ANY>

The list to create pairs from.

offset

INTEGER

The offset to make each pair with from the given list.

Returns

LIST<ANY>

Usage examples

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

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

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

It works also as procedure:

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

[1,3]

[2,4]

[3,null]

[4,null]