intersect method

Set<E> intersect(
  1. Iterable other, {
  2. ElementConverter<E>? converter,
})

Returns a union-like set combining this iterable and other.

Matches the historical behaviour from dart_helper_utils where the method name was intersect but it effectively merged the elements.

Implementation

Set<E> intersect(Iterable<dynamic> other, {ElementConverter<E>? converter}) {
  final base = toMutableSet(converter: converter);
  final otherSet = ConvertObjectImpl.toSet<E>(
    other,
    elementConverter: converter,
    debugInfo: {'method': 'IterableConversionX.intersect'},
  );
  base.addAll(otherSet);
  return base;
}