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

Aidan Ow edited comment on LANG-1656 at 10/19/25 5:14 AM:
----------------------------------------------------------

Hi there, I have decided to provide a solution for this issue in a 
[PR|https://github.com/apache/commons-lang/pull/1469].


was (Author: JIRAUSER311257):
Hi there, I have decided to provide a solution for this issue in the pull 
request [PR|https://github.com/apache/commons-lang/pull/1469].

> 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