[concurrency-interest] Reference/IdentityMap toString

Tim Peierls tim at peierls.net
Mon Aug 23 21:11:46 EDT 2010

On Mon, Aug 23, 2010 at 4:35 PM, Jason Mehrens <jason_mehrens at hotmail.com>wrote:

> I guess the practical version of my original question is: "Say some day the
> next great reference/identity map is being integrated into the java of the
> future.  Should the implementation use AbstractMap.toString that suffers
> from some issues in this context or since it is a specialized map perhaps it
> should provide a specialized toString to fix these issues?"

I don't accept the premise that AbstractMap.toString "suffers from some
issues" when used as part of an implementation of an identity map.
AbstractMap.toString is not broken or deficient; you are asking too much of
it. You're trying to turn it into a serialization mechanism, something it is
not meant for.

If you feel you really do need uniqueness of string representations for your
identity maps, you can achieve it without imposing extra complications for
those who don't. Several people have given examples of how you might
accomplish this in practice.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cs.oswego.edu/pipermail/concurrency-interest/attachments/20100823/8ebbace1/attachment.html>

More information about the Concurrency-interest mailing list