提交 ccb18dfc 编写于 作者: K Kohsuke Kawaguchi

added another convenience method

上级 97e00ae4
......@@ -69,6 +69,16 @@ public abstract class CopyOnWriteMap<K,V> implements Map<K,V> {
view = Collections.unmodifiableMap(core);
}
/**
* Atomically replaces the entire map by the copy of the specified map.
*/
public void replaceBy(Map<? extends K, ? extends V> data) {
Map<K, V> d = copy();
d.clear();
d.putAll(data);
update(d);
}
public int size() {
return core.size();
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册