apoc.coll.pairWithOffset

This is both a function and a procedure.

Function Details

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>

Procedure Details

Details

Syntax

apoc.coll.pairWithOffset(coll, offset) :: (value)

Description

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

Input 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.

Return arguments

Name

Type

Description

value

LIST<ANY>

The created pair.

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]