hg: lambda/lambda/jdk: Summary: add ThreadLocal(Factory<T>) and compareAndSet methods

Aleksey Shipilev aleksey.shipilev at oracle.com
Tue Jul 31 05:41:30 PDT 2012


(sorry for double post, forgot to remove GPG signature)

On 07/31/2012 04:10 PM, David Holmes wrote:
> On 31/07/2012 8:35 PM, Aleksey Shipilev wrote:
>> Please make sure you have both versions in place (i.e.
>> updateAndGet/getAndUpdate). Also, while you are at it, can you also add
>> the updaters for AtomicReference and friends?
> 
> What do you mean? What can you do to a reference other than set it?

Transform, given the current state? Trivial case:

   private class Holder {
       int x;
       int y;
   }

   private AtomicReference<Holder> holder = ...;

   holder.updateAndGet(h -> new Holder(h.x + 1, h.y + 1));

Is this too much to ask? :)

-Aleksey.






More information about the lambda-dev mailing list