intersect method
Returns a new lazy Iterable containing all elements that are contained
by both this collection and the other collection.
The returned collection preserves the element iteration order of the this collection.
This function uses HashSets to check which elements are the same. If
your collections already are HashSets (or a similar base type), then
using DelegatingSet.intersection directly is more efficient.
Implementation
Iterable<E> intersect(Iterable<E> other) sync* {
final otherSet = core_coll.HashSet<E>.from(other);
final copySet = core_coll.HashSet<E>();
for (final item in this) {
if (!otherSet.contains(item)) continue;
if (!copySet.add(item)) continue;
yield item;
}
}