Java tutorial
//package com.java2s; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.atomic.AtomicLong; public class Main { public static void addLong(ConcurrentMap<String, AtomicLong> map, String key, long delta) { map.putIfAbsent(key, new AtomicLong(0)); map.get(key).getAndAdd(delta); } }