On Tue, 1 Jun 2004, Emmanuel Bourg wrote:
> Only if the dates are not null of course, otherwise it becomes something
How about Collections.min(Arrays.asList(new Date[] { date1, date2 })) ?
I'm not sure how Date.compareTo() reacts to null (it's not specified in
the javadoc), but if it reacts poorly, all you need is a
public class NullNaturalComparator implements Comparator {
public int compare(Object o1, Object o2) {
if (o1==null) return (o2==null) ? 0 : -1;
if (o2==null) return +1;
return ((Comparable)o1).compareTo(o2);
}
}
--scott
Marxist Shoal Bay Rijndael Pakistan NSA anthrax ammunition Sugar Grove
RUCKUS Hawk Suharto shortwave SSBN 743 Nader assassination politics
( http://cscott.net/ )
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]