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

Joe Darcy Joe.Darcy at Sun.COM
Fri Oct 2 20:26:09 UTC 2009


Jason Mehrens wrote:
> > By toIdentityString, do you mean the String that would be returned by
> > toString if toString is not overridden?
> >
> > -Joe
>
> Yep.  As in:
>  
> return o != null ? o.getClass().getName() +'@' <mailto:+%27@%27>+  
> Integer.toHexString(System.identityHashCode(o)) : "null";
>  
> I suppose the name should be identityToString to match 
> System.identityHashCode???
>  
> Jason

I think a better name would be "defaultToString" since it is the default 
toString from Object.  However, I haven't ever heard anyone else request 
easier access to the default toString before so I'm not convinced this 
should go into Objects.

-Joe



More information about the core-libs-dev mailing list