UnionSet<E>.from constructor

UnionSet<E>.from(
  1. Iterable<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. However, unlike UnionSet.new, 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);