Here you can find the source of min(Calendar... dates)
Parameter | Description |
---|---|
dates | These values can be null |
public static Calendar min(Calendar... dates)
//package com.java2s; //License from project: Apache License import java.util.*; public class Main { /**//from ww w. j av a2s.c o m * Takes in a varargs of calendars and returns the one with the earliest date * * @param dates These values can be null * @return Calendar with the least date or null if no valid dates found */ public static Calendar min(Calendar... dates) { Calendar least = null; for (Calendar calendar : dates) { if (calendar != null) { if (least == null) { least = calendar; } else { if (calendar.before(least)) { least = calendar; } } } } return least; } /** * Date one comes before date two. * * @param dt date one * @param dt2 date two * @return true if neither are null and the first is before the second */ public static boolean before(Date dt, Date dt2) { return !(dt == null || dt2 == null) && dt.before(dt2); } }