intersect method
Implementation
Set intersect(Set other) {
Set a, b;
List<dynamic> intersection = [];
if (other is _CompleteSet) {
return this;
}
if (other is _EmptySet) {
return other;
}
if (length < other.length) {
a = this;
b = other;
} else {
a = other;
b = this;
}
for (final el in a.elements.keys) {
if (b.elements.containsKey(el)) {
intersection.add(el);
}
}
return Set(intersection);
}