增加max函数

This commit is contained in:
dylan 2021-03-20 12:50:17 +08:00
parent 54378aeed3
commit 62b86bda55

View File

@ -59,4 +59,14 @@ public class DateUtils {
return calendar.getTime();
}
public static Date max(Date a, Date b) {
if (a == null) {
return b;
}
if (b == null) {
return a;
}
return a.compareTo(b) > 0 ? a : b;
}
}