addAll method

  1. @override
bool addAll(
  1. Iterable<V> items
)
override

Adds all elements to this set.

Equivalent to adding each element in elements using add, but some collections may be able to optimize it.

final characters = <String>{'A', 'B'};
characters.addAll({'A', 'B', 'C'});
print(characters); // {A, B, C}

Implementation

@override
bool addAll(Iterable<V> items) {
  bool modified = false;
  for (final item in items) {
    if (add(item)) {
      modified = true;
    }
  }
  return modified;
}