commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ted Dunning <ted.dunn...@gmail.com>
Subject Re: new feature: coalesce operator / method
Date Fri, 30 Oct 2009 19:56:21 GMT
Write up a JIRA and a patch and go for it!

I would recommend that the name be "firstNonNull" rather than "coalesce".
The verb coalesce implies things coming together rather than selecting one
of many.

On Fri, Oct 30, 2009 at 6:39 AM, thomas menzel <dev.tom.menzel@gmx.net>wrote:

> hi,
>
> after writing an if (x != null) {o = ...} else if (y != null) {o = } ...
> cascade, i just thought that we could use a coalesce operator in java as
> well....
>
>
> until sun will support this i think this could be hosted somewhere in the
> commons.lang package:
>
> Operators.coalesce(final Object... object);
>
> this then would return the first non-null objecet from the given
> list/array.
>
> alternatively this could also go on ObjectUtils.
>
> what do u think?
>
> --
> Neu: GMX DSL bis 50.000 kBit/s und 200,- Euro Startguthaben!
> http://portal.gmx.net/de/go/dsl02
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>


-- 
Ted Dunning, CTO
DeepDyve

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message