public void testPutIfAbsent() { var key1 = new MyKey(); var key2 = new MyKey(); var key3 = new MyKey(); var value1 = new MyValue(); var value2 = new MyValue(); var value3 = new MyValue(); var map = new OpenIdentityHashMap<MyKey, MyValue>(); AssertEquals(null, map.Put(key1, value1)); AssertEquals(value1, map.Put(key1, value2)); AssertEquals(value2, map.Put(key1, value1)); AssertEquals(null, map.Put(key3, value3)); AssertEquals(value1, map.PutIfAbsent(key1, value2)); AssertEquals(null, map.PutIfAbsent(key2, value2)); AssertEquals(value2, map.PutIfAbsent(key2, value1)); AssertEquals(value3, map.Put(key3, value2)); }
public void testPutIfAbsent() { var key1 = new MyKey(); var key2 = new MyKey(); var key3 = new MyKey(); var value1 = new MyValue(); var value2 = new MyValue(); var value3 = new MyValue(); var map = new OpenIdentityHashMap <MyKey, MyValue>(); AssertEquals(null, map.Put(key1, value1)); AssertEquals(value1, map.Put(key1, value2)); AssertEquals(value2, map.Put(key1, value1)); AssertEquals(null, map.Put(key3, value3)); AssertEquals(value1, map.PutIfAbsent(key1, value2)); AssertEquals(null, map.PutIfAbsent(key2, value2)); AssertEquals(value2, map.PutIfAbsent(key2, value1)); AssertEquals(value3, map.Put(key3, value2)); }
public DictionaryImplOpenIdentityHashMap() { map = new OpenIdentityHashMap <TKey, TValue>(); }
/// <summary> /// Default ctor /// </summary> public DictionaryImplOpenIdentityHashMap(DictionaryImplOpenIdentityHashMap <TKey, TValue> source) { map = new OpenIdentityHashMap <TKey, TValue>(source.map); }
public DictionaryImplOpenIdentityHashMap(int capacity) { map = new OpenIdentityHashMap <TKey, TValue>(capacity); }
public OpenIdentityHashMap(OpenIdentityHashMap <K, V> other, int newSize = 0) : base(other, newSize) { }