/** Remove one occurrence of the object from the multiset */ public void remove(T obj) { RefLong x = map.get(obj); if (x == null) return; x.dec(); multiSetSize--; if (x.value() == 0) map.remove(obj); }
/** Remove N occurrences of the object from the multiset */ public void remove(T obj, long n) { RefLong x = map.get(obj); if (x == null) return; long z = x.value(); if (z < n) n = z; x.subtract(n); multiSetSize -= n; if (x.value() <= 0) map.remove(obj); }
/** Remove all occurrences of the object in themultiset */ public void removeAll(T obj) { RefLong x = map.get(obj); if (x == null) return; multiSetSize -= x.value(); map.remove(obj); }