apoc.coll.isEqualCollection

Function APOC Core

apoc.coll.isEqualCollection(coll, values) return true if two collections contain the same elements with the same cardinality in any order (using a HashMap)

Signature

apoc.coll.isEqualCollection(coll :: LIST? OF ANY?, values :: LIST? OF ANY?) :: (BOOLEAN?)

Input parameters

Name Type Default

coll

LIST? OF ANY?

null

values

LIST? OF ANY?

null

Usage Examples

The following checks if two collections contain exactly the same values in any order:

RETURN apoc.coll.isEqualCollection([1,4,5], [1,5,4]) AS output;
Table 1. Results
Output

TRUE

If the collections contain the same unique values but have a different cardinality, they aren’t considered equal:

RETURN apoc.coll.isEqualCollection([1,4,4,5], [1,5,4]) AS output;
Table 2. Results
Output

FALSE