public bool IsSubset(GenericSet <T> other) { if (other.IsNull()) { throw new ArgumentNullException("other"); } if (this.Size > other.Size) { return(false); } return(data.Keys.All(item => other.Contains(item))); }
public GenericSet <T> Difference(GenericSet <T> other) { if (other.IsNull()) { throw new ArgumentNullException("other"); } GenericSet <T> newSet = new GenericSet <T>(); foreach (T item in data.Keys) { if (!other.Contains(item)) { newSet.Add(item); } } return(newSet); }
public GenericSet <T> Intersection(GenericSet <T> other) { GenericSet <T> newSet = new GenericSet <T>(); if (other.IsNull()) { return(null); } foreach (T key in data.Keys) { if (other.Contains(key)) { newSet.Add(key); } } return(newSet); }