You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Bernhard Bonigl (Jira)" <ji...@apache.org> on 2020/01/07 10:14:00 UTC
[jira] [Created] (LANG-1513) ObjectUtils: Lazy evaluation of
firstNonNull
Bernhard Bonigl created LANG-1513:
-------------------------------------
Summary: ObjectUtils: Lazy evaluation of firstNonNull
Key: LANG-1513
URL: https://issues.apache.org/jira/browse/LANG-1513
Project: Commons Lang
Issue Type: New Feature
Components: lang.*
Reporter: Bernhard Bonigl
{{ObjectUtils.firstNonNull}} takes values, and returns the first non null. This is often used when multiple options have to be tried one after another.
When each option is expensive to compute, you don't want to calculate them all beforehand, but only evaluate them when needed. For this I propose {{firstNonNullLazy}}, which takes a Supplier and only evaluates the value if it needs to be checked.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)