apoc.coll.containsAll

Function

apoc.coll.containsAll(coll1 [Any], coll2 [Any]) - returns whether or not all of the given values exist in the given collection (using a HashSet).

Signature

apoc.coll.containsAll(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 a collection contains all the values from another collection:

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

FALSE

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

TRUE

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

TRUE