Objects.toString [Re: What methods should go into a java.util.Objects class in JDK 7?]

Paul Benedict pbenedict at apache.org
Thu Oct 8 18:21:59 UTC 2009


>> Why would you choose to return "null" for any null object?
>
> Because that is how the platform has always treated null in string
> concatenation.

If you were defining new operations for String, StringBuilder, or
StringBuffer, I would agree with your choice. Since you are now
defining a global utility method for all objects, I think having
"null" being the de-facto string representation of null is simply
taking it too far.

Paul



More information about the core-libs-dev mailing list