private void UpdateSortedValues(SortedSet <TValue> bucket, TValue?previousLast) { TValue?newLast = bucket.Max; if (!Equals(previousLast, newLast)) { if (previousLast is not null) { _worstSortedValues.Remove(previousLast); } _worstSortedValues.Add(newLast, GetKey(newLast)); } }
/// <summary> /// Actual insert mechanism. /// </summary> protected virtual void InsertCore(TKey key, TValue value, ICollection <TValue> bucketCollection) { bucketCollection.Add(value); _cacheMap.Add(key, value); _sortedValues.Add(value, key); }