public SET <T> Intersection(SET <T> otherset) { SET <T> retVal = new SET <T>(this.Comparator); foreach (T item in this) { if (otherset.Contains(item)) { retVal.Add(item); } } return(retVal); }
public SET <T> Except(SET <T> otherset) { SET <T> retVal = new SET <T>(); foreach (T item in this) { if (!otherset.Contains(item)) { retVal.Add(item); } } return(retVal); }
/// <summary> /// Create a union of this set and another set /// </summary> public SET <T> Union(T element) { SET <T> retVal = new SET <T>(); foreach (T item in this) { retVal.Add(item); } if (!retVal.Contains(element)) { retVal.Add(element); } return(retVal); }
public SET <T> Union(SET <T> otherset) { SET <T> retVal = new SET <T>(); foreach (T item in this) { retVal.Add(item); } foreach (T item in otherset) { if (!retVal.Contains(item)) { retVal.Add(item); } } return(retVal); }