apoc.coll.union

Function

apoc.coll.union(list1 [Any], list2 [Any]) - returns the distinct union of the two given lists.

Signature

apoc.coll.union(first :: LIST? OF ANY?, second :: LIST? OF ANY?) :: (LIST? OF ANY?)

Input parameters

Name Type Default

first

LIST? OF ANY?

null

second

LIST? OF ANY?

null

Usage examples

The following creates a distinct union of two lists:

RETURN apoc.coll.union([1,2,3,4,5], [3,4,5,6,7]) AS output;
Table 1. Results
Output

[1, 2, 3, 4, 5, 6, 7]