• Represents a union set operation, where the union is the elements from both set A and set B.

    • Formal definition: A ∪ B = {x: x ∈ A | x ∈ B}
    • This method runs in linear time, or O(n * m), where n = |B| (size of set B).
    • This method has no side effects, returning a new Set<TElement> instance.

    Type Parameters

    • TElement

    Parameters

    • a: Set<TElement>

      Set A of type <TElement> elements

    • b: Set<TElement>

      Set B of type <TElement> elements

    Returns Set<TElement>

    Union of A and B

    See

    Set.prototype.union

    Example

    // {A, B, C} ∪ {E, F, G} = {A, B, C, D, E, F, G}
    getUnion(new Set(['A', 'B', 'C']), new Set(['E', 'F', 'G'])); // new Set(['A', 'B', 'C', 'E', 'F', 'G'])

Generated using TypeDoc