let's play TDD, tackles closures in java

Peter Levart peter.levart at marand.si
Mon Dec 20 03:51:04 PST 2010


On 12/20/10, Reinier Zwitserloot wrote:
> Boxing
> for Atomics is a much bigger deal, though (as boxing for java.lang.Integer
> and friends has shown). There'd be far less complexity if this boxing only
> works for assignments / variable initializations.
> 
> i.e.:
> 
> AtomicInteger foo = 10; // this works

// and would, pressumably be translated to:
AtomicInteger foo = new AtomicInteger(10);

> foo = 20; // this works

// but is not known whether it should be translated to:
 foo = new AtomicInteger(10);
// or to:
foo.set(10);


Atomic* classes are mutable containers - not like immutable primitive wrappers that can, to some limited degree, mimic the value semantics.


Regards, Peter


More information about the lambda-dev mailing list