[concurrency-interest] ConcurrentHashMapV8

Brian Goetz brian at briangoetz.com
Fri Sep 2 21:42:22 EDT 2011


> In the lambda expression example,
>
>      computeIfAbsent( k, #{ k ->  calc(k) } );
>
> a new object (the function) is created every time, which is quite
> expensive relative to get(). So it pays to

No, this is incorrect for a significant fraction of the cases.  For 
lambdas that don't capture values from the enclosing scope (which is not 
all of them, but a lot of them), no object will be created (after the 
first one.)



More information about the Concurrency-interest mailing list