[concurrency-interest] Re: AtomicInteger and AtomicLong should implement Number

Gregg Wonderly gregg.wonderly@pobox.com
Wed, 14 Jan 2004 07:44:46 -0600


Dawid Kurzyniec wrote:
> If you have code like that, which does arithmetic on number wrappers
> rather than on flat primitives, you can't seriously claim that this
> particular application is concerned about memory allocation overhead
> caused by the wrappers. 

One wrapper is fine because this code works for Double, Integer, Byte, 
Short, Long etc.  Adding the use of AtomicX into this code will make it 
necessary to have a version for each type, and that will square the 
required number of instances if I have to use templates because of mixed 
types.

Dawid, you are failing to understand the argument.  You have some kind 
of myopic view of this issue clouded by the fact that any API that does 
have just native integer values and Maps that are non-value keyed is 
foreign and probably not useful or meaningful.

Gregg