public void Increment(T key) { MutableInteger count = get(key); if (count == null) { MutableInteger newCount = new MutableInteger(); newCount.Value = 1; counts.Add(key, newCount); } else { count.Increment(); } }
public int this[T key] { get { return(GetCount(key)); } set { MutableInteger mi = get(key); if (mi == null) { mi = new MutableInteger(); counts.Add(key, mi); } ; mi.Value = value; } }
public int GetCount(T key) { MutableInteger count = get(key); return(count == null ? 0 : count.Value); }