commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "thomas menzel" <>
Subject new feature: coalesce operator / method
Date Fri, 30 Oct 2009 13:39:37 GMT

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!

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message