public void Clear() { foreach (var bucket in buckets) { var hashCode = bucket.HashCode; Jsni.delete(storage[hashCode]); } count = 0; }
public bool Remove(TKey key) { var hashCode = comparer.GetHashCode(key).ToString(); var bucket = storage[hashCode].As <Bucket>(); if (bucket != null) { var items = bucket.Items.Where(x => comparer.Equals(x.Key, key)).GetEnumerator(); if (items.MoveNext()) { var item = items.Current; items.Dispose(); bucket.Items.Remove(item); if (bucket.Items.Count == 0) { Jsni.delete(storage[hashCode]); } count--; return(true); } } return(false); }