[
https://issues.apache.org/jira/browse/LANG-1656?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18030938#comment-18030938
]
Gary D. Gregory commented on LANG-1656:
---------------------------------------
I don't see the need for such a utility. Can this even be reused in Lang?
What's a use-case in another code base, like any other Commons component?
> 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)