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

Aidan Ow commented on LANG-1656:
--------------------------------

I have replied to this comment in the related PR :)

> 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
>   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)

Reply via email to