public TValue AddOrUpdate(TStrongKey strongKey, Func <TStrongKey, TValue> addValueFactory, Func <TStrongKey, TValue, TValue> updateValueFactory) { return (_internalDictionary.AddOrUpdate( Stacktype.Create(strongKey), ht => addValueFactory(ht.Item1), (ht, v) => updateValueFactory(ht.Item1, v) ) ); }
public TValue AddOrUpdate(TStrongKey strongKey, Func <TStrongKey, TValue> addValueFactory, Func <TStrongKey, TValue, TValue> updateValueFactory) { if (null == addValueFactory) { throw new ArgumentNullException("addValueFactory"); } if (null == updateValueFactory) { throw new ArgumentNullException("updateValueFactory"); } return (_internalDictionary.AddOrUpdate( new StrongKey <TStrongKey>(strongKey), hr => addValueFactory(hr._element), (hr, v) => updateValueFactory(hr._element, v) ) ); }
public TValue AddOrUpdate(TWeakKey1 weakKey1, TWeakKey2 weakKey2, TStrongKey strongKey, Func <TWeakKey1, TWeakKey2, TStrongKey, TValue> addValueFactory, Func <TWeakKey1, TWeakKey2, TStrongKey, TValue, TValue> updateValueFactory) { if (null == addValueFactory) { throw new ArgumentNullException("addValueFactory"); } if (null == updateValueFactory) { throw new ArgumentNullException("updateValueFactory"); } return (_internalDictionary.AddOrUpdate( Stacktype.Create(weakKey1, weakKey2, strongKey), hr => addValueFactory(hr.Item1, hr.Item2, hr.Item3), (hr, v) => updateValueFactory(hr.Item1, hr.Item2, hr.Item3, v) ) ); }