VelocityDbHashSetTIntersectWith Method |
Takes the intersection of this set with other. Modifies this set.
Implementation Notes:
We get better perf if other is a hashset using same equality comparer, because we
get constant contains check in other. Resulting cost is O(n1) to iterate over this.
If we can't go above route, iterate over the other and mark intersection by checking
contains in this. Then loop over and delete any unmarked elements. Total cost is n2+n1.
Attempts to return early based on counts alone, using the property that the
intersection of anything with the empty set is the empty set.
Namespace:
VelocityDb.Collection
Assembly:
VelocityDb (in VelocityDb.dll) Version: 11.1.0.0 (11.1)
Syntax public void IntersectWith(
IEnumerable<T> other
)
Public Sub IntersectWith (
other As IEnumerable(Of T)
)
public:
void IntersectWith(
IEnumerable<T>^ other
)
member IntersectWith :
other : IEnumerable<'T> -> unit
Parameters
- other
- Type: System.Collections.GenericIEnumerableT
enumerable with items to add
See Also