commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Work logged] (LANG-1435) ObjectUtils.defaultIfNull for slow default values
Date Fri, 01 Mar 2019 02:53:00 GMT

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

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

                Author: ASF GitHub Bot
            Created on: 01/Mar/19 02:52
            Start Date: 01/Mar/19 02:52
    Worklog Time Spent: 10m 
      Work Description: MarkDacek 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-468522634
 
 
   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?
 
----------------------------------------------------------------
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:
users@infra.apache.org


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

            Worklog Id:     (was: 206201)
            Time Spent: 20m  (was: 10m)
    Remaining Estimate: 10m  (was: 20m)

> 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: 20m
>  Remaining Estimate: 10m
>
> 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)

Mime
View raw message