Gary,
LANG-1634 [1] and PR 684 [2] opened for review.
Rob - yes exactly. I have found myself writing that utility method
multiple times, and almost all of those projects had commons-lang as a
dependency, so figured this would be a good place to have this
reusable piece of code.
Bindul
[1] https
applyIfNonNull looks to be a version of Optional without the Optional
object. The following is the same as suggested but with an additional
Optional object:
Optional.ofNullable(valueX).ifPresent(bean::setValue);
Optional.ofNullable(valueX).ifPresent(v -> someObject.compute(v,
"bar"));
Hi Bindul,
Let's see what this would look like with a PR :-)
Gary
On Mon, Dec 28, 2020, 01:23 Bindul Bhowmik wrote:
> Hi,
>
> I would like to propose an enhancement to the ObjectUtils class in lang:
>
> Background: I have seen multiple places in code where we have to check
> if a value is null
Hi,
I would like to propose an enhancement to the ObjectUtils class in lang:
Background: I have seen multiple places in code where we have to check
if a value is null before using it in a setter or other method, like:
if (valueX != null) {
bean.setValue(valueX);
someObject.com