let's play TDD, tackles closures in java
Neal Gafter
neal at gafter.com
Sat Dec 18 21:56:53 PST 2010
On Sat, Dec 18, 2010 at 2:17 PM, Artur Biesiadowski <abies at adres.pl> wrote:
> On 16/12/2010 08:30, Florian Weimer wrote:
> >
> > We can turn this into:
> >
> > final BooleanReference fired = new BooleanReference(false);
> > model.addTableModelListener(#{e -> fired.setValue(true)});
> > model.doThing();
> > assertTrue(fired.getValue());
>
> You can as well use AtomicBoolean, which has an extra benefit of having
> defined behaviour in multithreaded case.
>
And the extra disadvantage of having a much higher performance overhead in
the single-threaded case.
More information about the lambda-dev
mailing list