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

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

                Author: ASF GitHub Bot
            Created on: 01/Mar/19 17:10
            Start Date: 01/Mar/19 17:10
    Worklog Time Spent: 10m 
      Work Description: PascalSchumacher commented on issue #408: LANG-1435: 
Implemented defaultIfNull method that uses a supplier for default value
URL: https://github.com/apache/commons-lang/pull/408#issuecomment-468738322
 
 
   Thanks for the pull request!
   
   Java 11 offers `Objects#requireNonNullElseGet` (see 
https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Objects.html#requireNonNullElseGet(T,java.util.function.Supplier)
 for details), so I don't think we should add this.
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

            Worklog Id:     (was: 206530)
            Time Spent: 0.5h  (was: 20m)
    Remaining Estimate: 0h  (was: 10m)

> ObjectUtils.defaultIfNull for slow default values
> -------------------------------------------------
>
>                 Key: LANG-1435
>                 URL: https://issues.apache.org/jira/browse/LANG-1435
>             Project: Commons Lang
>          Issue Type: New Feature
>            Reporter: Dekel
>            Priority: Minor
>   Original Estimate: 0.5h
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> Currently, if the default value in defaultIfNull is computationally slow (for 
> example, it requires a database call, or complex calculations), it's not 
> worth using the util method. This feature is to implement a method that would 
> only perform this computationally slow action if the object value is actually 
> null. This can be done using a Supplier.
> In short, you'd call ObjectUtils.getDefaultIfNull(someNullableValue, 
> DbUtil::doGet) instead of ObjectUtils.defaultIfNull(someNullableValue, 
> DbUtil.doGet()) 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to