public void Add(T item) { lock (popularLock) { if (!resultCount.ContainsKey(item)) { Monitor.Pulse(popularLock); resultCount[item] = 1; countSet.Add(Tuple.Create(1, item)); } else { var oldCount = resultCount[item]; countSet.Remove(Tuple.Create(oldCount, item)); countSet.Add(Tuple.Create(oldCount + 1, item)); resultCount[item]++; } } }
public void Add(TIn item) { var result = selector(item); lock (minMaxLock) { if (!resultCounter.ContainsKey(result)) { Monitor.Pulse(minMaxLock); resultCounter[result] = 1; resultSet.Add(result); } else { resultCounter[result] += 1; } } UpdateValue(); }
public void Add(T item) { values.Add(item); }