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

Doug Lea dl@cs.oswego.edu
Wed, 14 Jan 2004 10:18:48 -0500

To try to recap decisions:

1. AtomicInteger extends Number to allow uniform access
to values by tools and utilities. (Similarly for toString
and serialization.)

2. It provides identity-based semantics for equality, as do
most stateful classes in Java.

3. In those cases where people want value-based equality etc
they can either rely on autoboxing, which provides reliable
semantics at the possible cost of overhead, or create subclasses
that add on particular equals, hashCode, and/or compareTo methods.

I believe that everyone has some straightforward path to getting desired
effects, and no reasonable usage is ruled out.