You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "James Carman (JIRA)" <ji...@apache.org> on 2008/07/28 19:11:31 UTC
[jira] Commented: (LANG-452) ObjectUtils.toString() should return
constant empty String from StringUtils:EMPTY instead a new Empty String
[ https://issues.apache.org/jira/browse/LANG-452?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12617476#action_12617476 ]
James Carman commented on LANG-452:
-----------------------------------
This wouldn't be a new String instance. This is the empty string literal. All literals will refer to the same object. Try it out:
{code}
System.out.println("" == StringUtils.EMPTY);
{code}
> ObjectUtils.toString() should return constant empty String from StringUtils:EMPTY instead a new Empty String
> ------------------------------------------------------------------------------------------------------------
>
> Key: LANG-452
> URL: https://issues.apache.org/jira/browse/LANG-452
> Project: Commons Lang
> Issue Type: Improvement
> Affects Versions: 2.4
> Reporter: Conny Kreyßel
>
> In commons-lang 2.4 the method
> public static String toString(Object obj) {
> return obj == null ? "" : obj.toString();
> }
> every call a new emptyb String.
> Is it possible to change it to
> public static String toString(Object obj) {
> return obj == null ? StringUtils.EMPTY : obj.toString();
> }
> ???
> This change saves IMHO resources?!
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.