public void testWeakHashMap1() { var key1 = new MyKey(); var key2 = new MyKey(); var value1 = new MyValue(); var value2 = new MyValue(); var map = new OpenWeakReferenceHashMap<MyKey, MyValue>(16); map.Put(key1, value1); map.Put(key2, value2); AssertEquals(value1, map.Get(key1)); AssertEquals(value2, map.Get(key2)); AssertEquals(2, map.Size); }
public void testWeakHashMap1() { var key1 = new MyKey(); var key2 = new MyKey(); var value1 = new MyValue(); var value2 = new MyValue(); var map = new OpenWeakReferenceHashMap <MyKey, MyValue>(16); map.Put(key1, value1); map.Put(key2, value2); AssertEquals(value1, map.Get(key1)); AssertEquals(value2, map.Get(key2)); AssertEquals(2, map.Size); }
private IOpenHashMap <MyKey, MyValue> CreateWeakMap() { var map = new OpenWeakReferenceHashMap <MyKey, MyValue>(16); map.Put(new MyKey(), new MyValue()); return(map); }
public void testWeakPutIfAbsent() { var key1 = new MyKey(); var key2 = new MyKey(); var value1 = new MyValue(); var value2 = new MyValue(); var map = new OpenWeakReferenceHashMap<MyKey, MyValue>(16); AssertEquals(null, map.Put(key1, value1)); AssertEquals(value1, map.Put(key1, value2)); AssertEquals(value2, map.Put(key1, value1)); AssertEquals(value1, map.PutIfAbsent(key1, value2)); AssertEquals(null, map.PutIfAbsent(key2, value2)); AssertEquals(value2, map.PutIfAbsent(key2, value1)); }
public void testWeakPutIfAbsent() { var key1 = new MyKey(); var key2 = new MyKey(); var value1 = new MyValue(); var value2 = new MyValue(); var map = new OpenWeakReferenceHashMap <MyKey, MyValue>(16); AssertEquals(null, map.Put(key1, value1)); AssertEquals(value1, map.Put(key1, value2)); AssertEquals(value2, map.Put(key1, value1)); AssertEquals(value1, map.PutIfAbsent(key1, value2)); AssertEquals(null, map.PutIfAbsent(key2, value2)); AssertEquals(value2, map.PutIfAbsent(key2, value1)); }
private IOpenHashMap<MyKey, MyValue> CreateWeakMap() { var map = new OpenWeakReferenceHashMap<MyKey, MyValue>(16); map.Put(new MyKey(), new MyValue()); return map; }