Coll { @UserFunction @Description("apoc.coll.toSet([list]) returns a unique list backed by a set") public List<Object> toSet(@Name("values") List<Object> list) { if (list == null) return null; return new SetBackedList(new LinkedHashSet(list)); }  @Procedure @Description("apoc.coll.zipToRows(list1,list2) - creates pairs like zip but emits one row per pair") Stream<ListResult> zipToRows(@Name("list1") List<Object> list1, @Name("list2") List<Object> list2); @UserFunction @Description("apoc.coll.zip([list1],[list2])") List<List<Object>> zip(@Name("list1") List<Object> list1, @Name("list2") List<Object> list2); @UserFunction @Description("apoc.coll.pairs([1,2,3]) returns [1,2],[2,3],[3,null] ") List<List<Object>> pairs(@Name("list") List<Object> list); @UserFunction @Description("apoc.coll.pairsMin([1,2,3]) returns [1,2],[2,3]") List<List<Object>> pairsMin(@Name("list") List<Object> list); @UserFunction @Description("apoc.coll.sum([0.5,1,2.3])") Double sum(@Name("numbers") List<Number> list); @UserFunction @Description("apoc.coll.avg([0.5,1,2.3])") Double avg(@Name("numbers") List<Number> list); @UserFunction @Description("apoc.coll.min([0.5,1,2.3])") Object min(@Name("values") List<Object> list); @UserFunction @Description("apoc.coll.max([0.5,1,2.3])") Object max(@Name("values") List<Object> list); @Procedure @Description("apoc.coll.elements(list,limit,offset) yield _1,_2,..,_10,_1s,_2i,_3f,_4m,_5l,_6n,_7r,_8p - deconstruct subset of mixed list into identifiers of the correct type") Stream<ElementsResult> elements(@Name("values") List<Object> list, @Name(value = "limit",defaultValue = "-1") long limit,@Name(value = "offset",defaultValue = "0") long offset); @Procedure @Description("apoc.coll.partition(list,batchSize)") Stream<ListResult> partition(@Name("values") List<Object> list, @Name("batchSize") long batchSize); @UserFunction("apoc.coll.partition") @Description("apoc.coll.partition(list,batchSize)") List<Object> partitionFn(@Name("values") List<Object> list, @Name("batchSize") long batchSize); @Procedure @Description("apoc.coll.split(list,value) | splits collection on given values rows of lists, value itself will not be part of resulting lists") Stream<ListResult> split(@Name("values") List<Object> list, @Name("value") Object value); @UserFunction @Description("apoc.coll.contains(coll, value) optimized contains operation (using a HashSet) (returns single row or not)") boolean contains(@Name("coll") List<Object> coll, @Name("value") Object value); @UserFunction @Description("apoc.coll.set(coll, index, value) | set index to value") List<Object> set(@Name("coll") List<Object> coll, @Name("index") long index, @Name("value") Object value); @UserFunction @Description("apoc.coll.insert(coll, index, value) | insert value at index") List<Object> insert(@Name("coll") List<Object> coll, @Name("index") long index, @Name("value") Object value); @UserFunction @Description("apoc.coll.insertAll(coll, index, values) | insert values at index") List<Object> insertAll(@Name("coll") List<Object> coll, @Name("index") long index, @Name("values") List<Object> values); @UserFunction @Description("apoc.coll.remove(coll, index, [length=1]) | remove range of values from index to length") List<Object> remove(@Name("coll") List<Object> coll, @Name("index") long index, @Name(value = "length",defaultValue = "1") long length); @UserFunction @Description("apoc.coll.indexOf(coll, value) | position of value in the list") long indexOf(@Name("coll") List<Object> coll, @Name("value") Object value); @UserFunction @Description("apoc.coll.containsAll(coll, values) optimized contains-all operation (using a HashSet) (returns single row or not)") boolean containsAll(@Name("coll") List<Object> coll, @Name("values") List<Object> values); @UserFunction @Description("apoc.coll.containsSorted(coll, value) optimized contains on a sorted list operation (Collections.binarySearch) (returns single row or not)") boolean containsSorted(@Name("coll") List<Object> coll, @Name("value") Object value); @UserFunction @Description("apoc.coll.containsAllSorted(coll, value) optimized contains-all on a sorted list operation (Collections.binarySearch) (returns single row or not)") boolean containsAllSorted(@Name("coll") List<Object> coll, @Name("values") List<Object> values); @UserFunction @Description("apoc.coll.isEqualCollection(coll, values) return true if two collections contain the same elements with the same cardinality in any order (using a HashMap)") boolean isEqualCollection(@Name("coll") List<Object> first, @Name("values") List<Object> second); @UserFunction @Description("apoc.coll.toSet([list]) returns a unique list backed by a set") List<Object> toSet(@Name("values") List<Object> list); @UserFunction @Description("apoc.coll.sumLongs([1,3,3])") Long sumLongs(@Name("numbers") List<Number> list); @UserFunction @Description("apoc.coll.sort(coll) sort on Collections") List<Object> sort(@Name("coll") List<Object> coll); @UserFunction @Description("apoc.coll.sortNodes([nodes], 'name') sort nodes by property") List<Node> sortNodes(@Name("coll") List<Node> coll, @Name("prop") String prop); @UserFunction @Description("apoc.coll.sortMaps([maps], 'name') - sort maps by property") List<Map<String,Object>> sortMaps(@Name("coll") List<Map<String,Object>> coll, @Name("prop") String prop); int reverseOrder(String prop); String cleanProperty(String prop); static int compare(Object o1, Object o2); @UserFunction @Description("apoc.coll.union(first, second) - creates the distinct union of the 2 lists") List<Object> union(@Name("first") List<Object> first, @Name("second") List<Object> second); @UserFunction @Description("apoc.coll.subtract(first, second) - returns unique set of first list with all elements of second list removed") List<Object> subtract(@Name("first") List<Object> first, @Name("second") List<Object> second); @UserFunction @Description("apoc.coll.removeAll(first, second) - returns first list with all elements of second list removed") List<Object> removeAll(@Name("first") List<Object> first, @Name("second") List<Object> second); @UserFunction @Description("apoc.coll.intersection(first, second) - returns the unique intersection of the two lists") List<Object> intersection(@Name("first") List<Object> first, @Name("second") List<Object> second); @UserFunction @Description("apoc.coll.disjunction(first, second) - returns the disjunct set of the two lists") List<Object> disjunction(@Name("first") List<Object> first, @Name("second") List<Object> second); @UserFunction @Description("apoc.coll.unionAll(first, second) - creates the full union with duplicates of the two lists") List<Object> unionAll(@Name("first") List<Object> first, @Name("second") List<Object> second); @UserFunction @Description("apoc.coll.shuffle(coll) - returns the shuffled list") List<Object> shuffle(@Name("coll") List<Object> coll); @UserFunction @Description("apoc.coll.randomItem(coll)- returns a random item from the list, or null on an empty or null list") Object randomItem(@Name("coll") List<Object> coll); @UserFunction @Description("apoc.coll.randomItems(coll, itemCount, allowRepick: false) - returns a list of itemCount random items from the original list, optionally allowing picked elements to be picked again") List<Object> randomItems(@Name("coll") List<Object> coll, @Name("itemCount") long itemCount, @Name(value = "allowRepick", defaultValue = "false") boolean allowRepick); @UserFunction @Description("apoc.coll.containsDuplicates(coll) - returns true if a collection contains duplicate elements") boolean containsDuplicates(@Name("coll") List<Object> coll); @UserFunction @Description("apoc.coll.duplicates(coll) - returns a list of duplicate items in the collection") List<Object> duplicates(@Name("coll") List<Object> coll); @UserFunction @Description("apoc.coll.duplicatesWithCount(coll) - returns a list of duplicate items in the collection and their count, keyed by `item` and `count` (e.g., `[{item: xyz, count:2}, {item:zyx, count:5}]`)") List<Map<String, Object>> duplicatesWithCount(@Name("coll") List<Object> coll); @UserFunction @Description("apoc.coll.frequencies(coll) - returns a list of frequencies of the items in the collection, keyed by `item` and `count` (e.g., `[{item: xyz, count:2}, {item:zyx, count:5}, {item:abc, count:1}]`)") List<Map<String, Object>> frequencies(@Name("coll") List<Object> coll); @UserFunction @Description("apoc.coll.frequenciesAsMap(coll) - return a map of frequencies of the items in the collection, key `item`, value `count` (e.g., `{1:2, 2:1}`)") Map<String, Object> frequenciesAsMap(@Name("coll") List<Object> coll); @UserFunction @Description("apoc.coll.occurrences(coll, item) - returns the count of the given item in the collection") long occurrences(@Name("coll") List<Object> coll, @Name("item") Object item); @UserFunction @Description("apoc.coll.flatten(coll, [recursive]) - flattens list (nested if recursive is true)") List<Object> flatten(@Name("coll") List<Object> coll,  @Name(value="recursive", defaultValue = "false") boolean recursive); @Deprecated @UserFunction @Description("apoc.coll.reverse(coll) - returns reversed list") List<Object> reverse(@Name("coll") List<Object> coll); @UserFunction("apoc.coll.sortMulti") @Description("apoc.coll.sortMulti(coll, ['^name','age'],[limit],[skip]) - sort list of maps by several sort fields (ascending with ^ prefix) and optionally applies limit and skip") List<Map<String,Object>> sortMulti(@Name("coll") java.util.List<Map<String,Object>> coll,
                                              @Name(value="orderFields", defaultValue = "[]") java.util.List<String> orderFields,
                                              @Name(value="limit", defaultValue = "-1") long limit,
                                              @Name(value="skip", defaultValue = "0") long skip); @UserFunction @Description("apoc.coll.combinations(coll, minSelect, maxSelect:minSelect) - Returns collection of all combinations of list elements of selection size between minSelect and maxSelect (default:minSelect), inclusive") List<List<Object>> combinations(@Name("coll") List<Object> coll, @Name(value="minSelect") long minSelectIn, @Name(value="maxSelect",defaultValue = "-1") long maxSelectIn); @UserFunction @Description("apoc.coll.different(values) - returns true if values are different") boolean different(@Name("values") List<Object> values); @UserFunction @Description("apoc.coll.dropDuplicateNeighbors(list) - remove duplicate consecutive objects in a list") List<Object> dropDuplicateNeighbors(@Name("list") List<Object> list); @UserFunction @Description("apoc.coll.fill(item, count) - returns a list with the given count of items") List<Object> fill(@Name("item") String item, @Name("count") long count); @UserFunction @Description("apoc.coll.sortText(coll) sort on string based collections") List<String> sortText(@Name("coll") List<String> coll, @Name(value = "conf", defaultValue = "{}") Map<String, Object> conf); static final char ASCENDING_ORDER_CHAR; @Context
    public GraphDatabaseService db; @Context public Transaction tx; }
@Test public void testToSet() throws Exception { testCall(db, "RETURN apoc.coll.toSet([1,2,1,3]) as value", (row) -> assertEquals(asList(1L, 2L, 3L), row.get("value"))); }