public int CompareTo(SET <TKey> that) { var union = Union(that); if (_set.Size() == that.Size() && _set.Size() == union.Size() && that.Size() == union.Size()) { return(0); } if (_set.Size() < that.Size()) { return(-1); } return(1); }
/// <summary> /// Returns the union of this set and that set. /// </summary> /// <param name="that">that the other set</param> /// <returns>the union of this set and that set</returns> /// <exception cref="NullReferenceException">if <tt>that</tt> is <tt>null</tt></exception> public SET <TKey> Union(SET <TKey> that) { if (that == null) { throw new NullReferenceException("called union() with a null argument"); } var c = new SET <TKey>(); foreach (var x in this) { c.Add(x); } foreach (var x in that) { c.Add(x); } return(c); }
public BlackFilter(IEnumerable <string> a) { _filter = new SET <string>();; InsertWords(a); }
public DeDup(IEnumerable <string> a) { _set = new SET <string>();; InsertWords(a); }