apoc.coll.isEqualCollection

Details

Syntax

apoc.coll.isEqualCollection(coll, values)

Description

Returns true if the two collections contain the same elements with the same cardinality in any order (using a HashMap).

Arguments

Name

Type

Description

coll

LIST<ANY>

The list of values to compare against list2 and check for equality.

values

LIST<ANY>

The list of values to compare against list1 and check for equality.

Returns

BOOLEAN

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;
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;
Results
Output

FALSE