hadoop-common-dev mailing list archives

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

             Summary: 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, util
            Reporter: Brandon Li
            Assignee: Brandon Li
            Priority: Minor


Prior to JDK 6, we can check if a string is empty in 2 ways:

   * if(s != null && s.length() == 0)
   * if(("").equals(s)) or if( 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

Mime
View raw message