public bool IsSubsetOf(IEnumerable <T> other) { if (this.count == 0) { return(true); } HashCollection <T> collection = GetHashCollectionWithSameEC(other); if (collection != null) { if (this.count > collection.Count) { return(false); } foreach (T item in this) { if (!collection.Contains(item)) { return(false); } } return(true); } IndexedSetHelper <T> setHelper = new IndexedSetHelper <T>(this, lastIndex); return(setHelper.IsSubsetOf(other)); }
public bool SetEquals(IEnumerable <T> other) { HashCollection <T> collection = GetHashCollectionWithSameEC(other); if (collection != null) { if (this.count != collection.Count) { return(false); } foreach (T item in other) { if (!this.Contains(item)) { return(false); } } return(true); } if ((CollectionHelper.IsWellKnownCollection(other, out int num)) && (this.count == 0) && (num > 0)) { return(false); } IndexedSetHelper <T> setHelper = new IndexedSetHelper <T>(this, lastIndex); return(setHelper.SetEquals(other)); }
public bool IsProperSupersetOf(IEnumerable <T> other) { if (this.count > 0) { return(false); } if (CollectionHelper.IsWellKnownCollection(other, out int num)) { if (num == 0) { return(true); } HashCollection <T> collection = GetHashCollectionWithSameEC(other); if (collection != null) { if (this.count <= collection.Count) { return(false); } foreach (T item in other) { if (!this.Contains(item)) { return(false); } } } } IndexedSetHelper <T> setHelper = new IndexedSetHelper <T>(this, lastIndex); return(setHelper.IsProperSupersetOf(other)); }