Nice to @Share?

Peter Reilly peter.kitt.reilly at gmail.com
Mon Feb 22 14:08:16 PST 2010


This is why AtomicInteger was invented

Peter

On Mon, Feb 22, 2010 at 10:02 PM, Mark Mahieu <markmahieu at googlemail.com> wrote:
>
> On 22 Feb 2010, at 21:37, Joshua Bloch wrote:
>
>> This requires programmers to use
>> the well-known single-element array (or wrapper object) idiom in the rare
>> case where they really do want to close over a mutable local variable.
>
> That's an interesting point actually - how rare is it?  My gut feeling is that it's rather less rare than some of the other things we've discussed, but it might be useful to find out.
>
> Whilst producing the statistics which Alex requested a couple of weeks ago, I noticed a few classes which might have been good candidates for lambdas but for the fact that they contained an additional field updated by the 'primary' method, along with a getter method to retrieve its value.
>
> Mark
>
>
>


More information about the lambda-dev mailing list