UnionSet<E>.from constructor

UnionSet<E>.from(Iterable<Set<E>> sets, { bool disjoint: false })

Creates a new set that's a view of the union of all sets in sets.

If any sets in sets change, this UnionSet reflects that change. However, unlike new UnionSet, this creates a copy of its parameter, so changes in sets aren't reflected in this UnionSet.

If disjoint is true, then all component sets must be disjoint. That is, that they contain no elements in common. This makes many operations including length more efficient. If the component sets turn out not to be disjoint, some operations may behave inconsistently.

Implementation

UnionSet.from(Iterable<Set<E>> sets, {bool disjoint: false})
    : this(sets.toSet(), disjoint: disjoint);