newMap = (AtomicHashMap) d.merge(null);
assert newMap.isEmpty();
}
public void testDeltasWithRepeatedChanges() {
AtomicHashMap m = new AtomicHashMap();
m.initForWriting();
m.put("k1", "v1");
m.put("k1", "v2");
m.put("k1", "v3");
assert m.size() == 1;
AtomicHashMapDelta d = (AtomicHashMapDelta) m.delta();
assert d.getChangeLogSize() != 0;
AtomicHashMap newMap = new AtomicHashMap();
newMap.initForWriting();
newMap.put("k1", "v4");
newMap = (AtomicHashMap) d.merge(newMap);
assert newMap.containsKey("k1");
assert newMap.get("k1").equals("v3");
assert newMap.size() == 1;
newMap = (AtomicHashMap) d.merge(null);
assert newMap.containsKey("k1");
assert newMap.get("k1").equals("v3");
assert newMap.size() == 1;
}