hadoop-common-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brandon Li (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HADOOP-8814) Inefficient comparison with the empty string. Use isEmpty() instead
Date Tue, 18 Sep 2012 20:53:08 GMT

    [ https://issues.apache.org/jira/browse/HADOOP-8814?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13458149#comment-13458149

Brandon Li commented on HADOOP-8814:

Thanks Suresh for reviewing it.
Yes, somestring.isEmpty() is not identical to "".equals(somestring). However, in the context
where "".equals(somestring) is replaced with somestring.isEmpty, there is the assumption that
somestring is not null.
> Inefficient comparison with the empty string. Use isEmpty() instead
> -------------------------------------------------------------------
>                 Key: HADOOP-8814
>                 URL: https://issues.apache.org/jira/browse/HADOOP-8814
>             Project: Hadoop Common
>          Issue Type: Improvement
>          Components: conf, fs, fs/s3, ha, io, metrics, performance, record, security,
>            Reporter: Brandon Li
>            Assignee: Brandon Li
>            Priority: Minor
>         Attachments: HADOOP-8814.patch
> Prior to JDK 6, we can check if a string is empty by doing "".equals(s) or s.equals("").
> Starting from JDK 6, String class has a new convenience and efficient method isEmpty()
to check string's length.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

View raw message