commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jörg Gottschling (JIRA) <j...@apache.org>
Subject [jira] Updated: (LANG-358) ObjectUtils.coalesce
Date Fri, 12 Oct 2007 06:29:50 GMT

     [ https://issues.apache.org/jira/browse/LANG-358?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Jörg Gottschling updated LANG-358:
----------------------------------

    Description: 
I like to see the coalesce-function from SQL implemented in ObjectUtils. Something like this:
<T> T ObjectUtils.coalesce(T... t)
The first object, which is not null will be returned. This would replace all the defaultValue/defaultString/...
methods, with al flexibler and shorter method. It will also reuse an existing name.

I think it's simple. Perhaps there should be overloading methods with fixed parameter sizes.
Following the jdk this seems to a little faster:
<T> T ObjectUtils.coalesce(T t1, T t2)
<T> T ObjectUtils.coalesce(T t1, T t2, T t3)
...

I would provide it, including tests, if you like.


  was:
I like to see the coalesce-function from SQL implemented in ObjectUtils. Something like this:
<T> T ObjectUtils.coalesce(T... t)
The first object, which is not null will be returned. I think it's simple. Perhaps there should
be overloading methods with fixed parameter sizes. Following the jdk this seems to a little
faster:
<T> T ObjectUtils.coalesce(T t1, T t2)
<T> T ObjectUtils.coalesce(T t1, T t2, T t3)
...

I would provide it, including tests, if you like.


> ObjectUtils.coalesce
> --------------------
>
>                 Key: LANG-358
>                 URL: https://issues.apache.org/jira/browse/LANG-358
>             Project: Commons Lang
>          Issue Type: New Feature
>    Affects Versions: LangTwo 1.0
>            Reporter: Jörg Gottschling
>            Priority: Minor
>
> I like to see the coalesce-function from SQL implemented in ObjectUtils. Something like
this:
> <T> T ObjectUtils.coalesce(T... t)
> The first object, which is not null will be returned. This would replace all the defaultValue/defaultString/...
methods, with al flexibler and shorter method. It will also reuse an existing name.
> I think it's simple. Perhaps there should be overloading methods with fixed parameter
sizes. Following the jdk this seems to a little faster:
> <T> T ObjectUtils.coalesce(T t1, T t2)
> <T> T ObjectUtils.coalesce(T t1, T t2, T t3)
> ...
> I would provide it, including tests, if you like.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message