[ 
https://issues.apache.org/jira/browse/LANG-1634?focusedWorklogId=530902&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-530902
 ]

ASF GitHub Bot logged work on LANG-1634:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 04/Jan/21 21:14
            Start Date: 04/Jan/21 21:14
    Worklog Time Spent: 10m 
      Work Description: coveralls edited a comment on pull request #684:
URL: https://github.com/apache/commons-lang/pull/684#issuecomment-751870250


   
   [![Coverage 
Status](https://coveralls.io/builds/36074207/badge)](https://coveralls.io/builds/36074207)
   
   Coverage decreased (-0.003%) to 94.988% when pulling 
**bde0870e64d4351f558c3377a037e792d35ac9fe on 
bindul:LANG-1634_ObjectUtils-applyIfNonNull** into 
**3ba01073f647da53e4ee662a491be88728cb8b6c on apache:master**.
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 530902)
    Time Spent: 2.5h  (was: 2h 20m)

> ObjectUtils - apply Consumer with non-null value
> ------------------------------------------------
>
>                 Key: LANG-1634
>                 URL: https://issues.apache.org/jira/browse/LANG-1634
>             Project: Commons Lang
>          Issue Type: Improvement
>          Components: lang.*
>            Reporter: Bindul Bhowmik
>            Priority: Minor
>              Labels: pull-request-available
>          Time Spent: 2.5h
>  Remaining Estimate: 0h
>
> There are multiple places in code where we have to check if a value is 
> {{null}} before using it in a setter or other method, like:
> {code:java}
> if (valueX != null) {
>       bean.setValue(valueX);
>       someObject.compute(valueX, "bar");
> }
> {code}
> This enhancement request is to add a couple of methods in {{ObjectUtils}} to 
> wrap this logic,  like the following:
> {code:java}
> public static <T> void applyIfNonNull(final Consumer<T> consumer, final T 
> object)
> public static <T> void applyFirstNonNull(final Consumer<T> consumer, final 
> T... objects)
> {code}
> With this the two statements above could be used as:
> {code:java}
> ObjectUtils.applyIfNonNull(bean::setValue, valueX);
> ObjectUtils.appyIfNonNull(v -> someObject.compute(v, "bar"), valueX);
> {code}
> The benefit of this should increase with more such null checks we need in the 
> code that can be replaced by single statements.
> Pull request forthcoming.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to