commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emmanuel Bourg <ebo...@micropole-univers.com>
Subject Re: [collections][lang] generic min/max functions
Date Tue, 01 Jun 2004 10:11:02 GMT
Rodney Waldhoff wrote:
> On Tue, 25 May 2004, matthew.hawthorne wrote:
> 
> Or, for what it's worth:
> 
> Date date = date1.compareTo(date2) > 0 date2 : date1;

Only if the dates are not null of course, otherwise it becomes something 
like :

Date date = null;

if (date1 != null && date 2 != null) {
     date = date1.compareTo(date2) > 0 ? date2 : date1;
} else {
     date = (date1 == null) ? date2 : date1;
}

That's this boiler plate I'd like to reduce to a simple expression.


Emmanuel Bourg

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message