Hey,

On Fri, Jan 28, 2011 at 2:01 PM, Stephen Williams <scient...@gmail.com> wrote:
> All objects are passed as references in Java.
> All fundamental scalar types have Object wrapped versions.
> An argument that is meant to be modified just needs to be an object
> reference.
>
> So, you can simply go from:
> void funkyReader(int arg) { arg++; }
> to:
> void funkyChanger(Integer arg) { arg++; }
>
> If it needs to be threadsafe, simply synchronize on the object everywhere it
> is used.

It's a bad idea to synchronize on the wrapper objects of primitive
types: http://www.theothertomelliott.com/node/40

This includes Integers.

Regards,
James

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org

Reply via email to