apoc.coll.containsSorted
Syntax |
|
||
Description |
Returns whether or not the given value exists in an already sorted collection (using a binary search). |
||
Arguments |
Name |
Type |
Description |
|
|
The sorted list to search for the given value. |
|
|
|
The value to check for the existence of in the list. |
|
Returns |
|
Usage examples
The following checks if a sorted collection contains a value:
RETURN apoc.coll.containsSorted([1,4,5], 4) AS output;
Output |
---|
TRUE |
This function will not work on unsorted collections, as shown in the example below:
RETURN apoc.coll.containsSorted([1,5,4], 4) AS output;
Output |
---|
FALSE |
If we want to find a value in an unsorted collection, see apoc.coll.contains.