Код: Выделить всё
ConcurrentHashMap chm = new ConcurrentHashMap();
if (chm.get(key) != null) {
chm.get(key).doSomething();
chm.remove(key);
}
Как сделать это потокобезопасным?
Код: Выделить всё
ConcurrentHashMap chm = new ConcurrentHashMap();
if (chm.get(key) != null) {
chm.get(key).doSomething();
chm.remove(key);
}