Ejemplo n.º 1
0
 public TValue AddOrUpdate(TKey key, Func <TKey, TValue> addValueFactory, Func <TKey, TValue, TValue> updateValueFactory)
 {
     return(internalDictionary.InsertOrUpdate(Hash(key),
                                              key,
                                              () => Make(key, addValueFactory(key)),
                                              (e) => Make(key, updateValueFactory(key, e.Value))).Value);
 }
Ejemplo n.º 2
0
		public TValue AddOrUpdate (TKey key, Func<TKey, TValue> addValueFactory, Func<TKey, TValue, TValue> updateValueFactory)
		{
			CheckKey (key);
			if (addValueFactory == null)
				throw new ArgumentNullException ("addValueFactory");
			if (updateValueFactory == null)
				throw new ArgumentNullException ("updateValueFactory");
			return internalDictionary.InsertOrUpdate (Hash (key),
			                                          key,
			                                          () => Make (key, addValueFactory (key)),
			                                          (e) => Make (key, updateValueFactory (key, e.Value))).Value;
		}