LANG-1435: Implemented defaultIfNull method that uses a supplier for default value#408
LANG-1435: Implemented defaultIfNull method that uses a supplier for default value#408dekelpilli wants to merge 4 commits intoapache:masterfrom dekelpilli:LANG-1435/supplier-default-if-null
Conversation
|
I'm curious whether this is worthwhile given the existence of ObjectUtils.firstNonNull. Is the supplier that much of a necessity? The only plus I see is that it wouldn't be executed if the default isn't null. Is that a major performance increase for a significant number of use-cases? |
|
Thanks for the pull request! Java 11 offers |
|
Ok we’ll close this I think. Many thanks all. |
|
I think it's useful, but I agree, if J11 has it then we shouldn't double up. |
|
Method suggested here serves slightly different use case and cannot always be substituted by |
From JIRA ticket: