This would have to devolve into a TTAS implementation in order to avoid
calling the supplier in cases where AR != expected.  Otherwise, hardware
needs the reference for the CAS.  TTAS isn't that common, I think.

Sent from my phone
On Nov 12, 2013 8:51 AM, "Gernot Neppert" <[email protected]> wrote:

> 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?
>

Reply via email to