【发布时间】:2014-01-22 15:18:25
【问题描述】:
在java中我习惯做以下事情:
boolean done = false;
while(!done) {
Long oldValue = map.putIfAbsent(key, 1L);
if(oldValue != null) {
done = map.replace(key, oldValue, oldValue + 1);
} else {
done = true;
}
}
现在我看到在 scala 中我最好使用 TrieMap(如果我坚持使用可变版本)我真的不明白这个 TrieMap 中是否已经存在一次性操作这个while循环给我,如果可以,你能举个例子吗?
【问题讨论】:
标签: java scala concurrency