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 RemoveZeroCounts() { ICollection <K1> firstKeySet = Generics.NewHashSet(FirstKeySet()); foreach (K1 k1 in firstKeySet) { IntCounter <K2> c = GetCounter(k1); Counters.RetainNonZeros(c); if (c.IsEmpty()) { Sharpen.Collections.Remove(map, k1); } } }