import { SortedArray } from "https://deno.land/x/structurae@4.0.1/sorted-array.ts";
Returns the union of two sorted arrays as a sorted array.
Examples
SortedArray.getUnion([1, 2, 3, 4, 8], [2, 4, 6, 7, 9]);
//=> [ 1, 2, 2, 3, 4, 4, 6, 7, 8, 9 ]
SortedArray.getUnion([1, 2, 3, 4, 8], [2, 4, 6, 7, 9]); //=> [ 1, 2, 2, 3, 4, 4, 6, 7, 8, 9 ]
// union of sorted arrays without duplicates: SortedArray.getUnion([1, 2, 3, 4, 8], [2, 4, 6, 7, 9], true); //=> [ 1, 2, 3, 4, 6, 7, 8, 9 ]
//union using a custom comparator: SortedArray.getUnion([8, 4, 3, 2, 1], [9, 7, 6, 4, 2], true, customComparator); //=> [ 9, 8, 7, 6, 4, 3, 2, 1 ]
Type Parameters
U extends IndexedCollection<T>
Parameters
optional
comparator: Comparator<T> = [UNSUPPORTED]optional
container: U = [UNSUPPORTED]