提交 5050c686 编写于 作者: 武汉红喜's avatar 武汉红喜

optimise

上级 d16775b8
......@@ -28,19 +28,19 @@ public class ConcurrentTreeMap<K, V> {
}
}
public V putIfAbsentAndRetExsit(K key, V value) {
public V putIfAbsent(K key, V value) {
lock.lock();
try {
if (roundQueue.put(key)) {
V exsit = tree.get(key);
if (null == exsit) {
V oldValue = tree.get(key);
if (null == oldValue) {
tree.put(key, value);
exsit = value;
oldValue = value;
}
return exsit;
return oldValue;
} else {
V exsit = tree.get(key);
return exsit;
V oldValue = tree.get(key);
return oldValue;
}
} finally {
lock.unlock();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册