On Tue, 25 May 2004, matthew.hawthorne wrote:

> Emmanuel Bourg wrote:
> > Yes it's an alternative, but at the cost of additional lines to create a
> > collection.
> >
> > Date date = ComparableUtils.min(date1, date2)
> >
> > vs
> >
> > Collection dates = new ArrayList();
> > dates.add(date1);
> > dates.add(date2);
> > Date date = (Date)Collections.min(dates);
>
>
> I see your point now.  But, in the meanwhile, you could always do it
> this way:
>
> Date date = Collections.min(Arrays.asList(new Date[] {date1, date2}))
>
> I'd imagine that this may be a bit wasteful (object-creation wise), but
> it's a one liner nonetheless.
>

Or, for what it's worth:

Date date = date1.compareTo(date2) > 0 date2 : date1;

 - R.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to