You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Gary D. Gregory (Jira)" <ji...@apache.org> on 2023/07/28 02:56:00 UTC

[jira] [Updated] (LANG-1656) Short-circuit operation of firstNonBlank and firstNonEmpty

     [ https://issues.apache.org/jira/browse/LANG-1656?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gary D. Gregory updated LANG-1656:
----------------------------------
    Fix Version/s: 3.13.1
                       (was: 3.13.0)

> Short-circuit operation of firstNonBlank and firstNonEmpty
> ----------------------------------------------------------
>
>                 Key: LANG-1656
>                 URL: https://issues.apache.org/jira/browse/LANG-1656
>             Project: Commons Lang
>          Issue Type: New Feature
>          Components: lang.*
>    Affects Versions: 3.12.0
>            Reporter: Zhengkai Wang
>            Priority: Minor
>              Labels: features
>             Fix For: 3.13.1
>
>   Original Estimate: 96h
>  Remaining Estimate: 96h
>
> Sometimes it is not possible to provide an array of strings, but only an array of methods to obtain a string to obtain a string. At this time, you do not need to execute all the methods in the method array, only need to execute until the first method whose result is not an empty string or a blank string. E.g. 
> {code:java}
> StringUtil.firstNonBlank(()-> "123", ()-> rpcMethod(), ()->dbQuery())
> {code}
>  In the above code, we only need to execute the first method, not the latter two methods, because the latter two methods may be time-consuming.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)