commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sebb (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LANG-1410) StringsUtil.isBlank check null first
Date Fri, 07 Sep 2018 12:51:00 GMT

    [ https://issues.apache.org/jira/browse/LANG-1410?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16607086#comment-16607086
] 

Sebb commented on LANG-1410:
----------------------------

However, in this case it would be possible to eliminate the variable entirely:

{code}
        if (cs == null) {
            return true;
        }
        for (int i = 0; i < cs.length(); i++) {
            if (!Character.isWhitespace(cs.charAt(i))) {
                return false;
            }
        }
        return true;
{code}

> StringsUtil.isBlank check null first
> ------------------------------------
>
>                 Key: LANG-1410
>                 URL: https://issues.apache.org/jira/browse/LANG-1410
>             Project: Commons Lang
>          Issue Type: Improvement
>          Components: lang.*
>            Reporter: Yifan Guo
>            Priority: Minor
>
> StringsUtil.isBlank should check null for cs first instead of declaring int strLen first.
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message