AtomicReference.compareAndSet Oversight?

Gernot Neppert mcnepp02 at googlemail.com
Tue Nov 12 13:51:11 UTC 2013


While testing the methods added to the "Atomic" classes for Java 8,
I was puzzled that I couldn't find the one method that I've been missing
most in AtomicReference:

boolean compareAndSet(V expect, Supplier<? extends V> supplier);

Obviously, this would help implement a very efficient atomic
"create-if-not-present" compound operation.
Was it a deliberate decision to leave that one out?



More information about the core-libs-dev mailing list