What methods should go into a java.util.Objects class in JDK 7?

Jason Mehrens jason_mehrens at hotmail.com
Fri Oct 2 14:41:28 UTC 2009


 > * null safe toString(Object), returning "null" for a null argument


Doesn't String.valueOf do the same thing?


What about a toIdentityString(Object) instead?  Some of the nice properties of an identity string is that it is safe to call from multiple threads even on objects that are not thread safe (JComponent), won't deadlock if toString is synchronized (observed in logging), and won't build run away strings (nCopies(Integer.MAX_VALUE, "lookout").toString()).


Hotmail® has ever-growing storage! Don’t worry about storage limits.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/core-libs-dev/attachments/20091002/0aee6a94/attachment.html>

More information about the core-libs-dev mailing list