UnionSet<E> constructor Null safety

  1. Set<Set<E>> sets,
  2. {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. If a new set is added to sets, this UnionSet reflects that as well.

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.


UnionSet(Set<Set<E>> sets, {bool disjoint = false})
    : _sets = sets,
      _disjoint = disjoint;