1
JavaAdvanced#concurrency
They provide lock-free, thread-safe operations on single variables using CAS (compare-and-swap) hardware instructions, avoiding the overhead of synchronized blocks for simple counters or flags.
AtomicInteger counter = new AtomicInteger(0); counter.incrementAndGet(); counter.compareAndSet(1, 5); // sets to 5 only if current value is 1