LongAdder跟AtomicLong功能类似,但是在高竞争的场景下表现更优。例如结合ConcurrentHashMap来维护一个频率列表:

ConcurrentHashMap<String,LongAdder> freqs; //...
freqs.computeIfAbsent(key, k -> new LongAdder()).increment();}