public virtual int Remove(K1 o1, K2 o2) { IntCounter <K2> c = GetCounter(o1); int oldCount = GetCount(o1, o2); total -= oldCount; c.Remove(o2); if (c.IsEmpty()) { Sharpen.Collections.Remove(map, o1); } return(oldCount); }
public virtual void Clean() { foreach (K1 key1 in Generics.NewHashSet(map.Keys)) { IntCounter <K2> c = map[key1]; foreach (K2 key2 in Generics.NewHashSet(c.KeySet())) { if (c.GetIntCount(key2) == 0) { c.Remove(key2); } } if (c.KeySet().IsEmpty()) { Sharpen.Collections.Remove(map, key1); } } }