Here you can find the source of minCalendars(List
Parameter | Description |
---|---|
calendars | the list of Calendar to calculate the minimum. |
public static Calendar minCalendars(List<Calendar> calendars)
//package com.java2s; import java.util.Calendar; import java.util.List; public class Main { /**// w ww . jav a2 s.c o m * Returns the minimum Calendar in the Calendar list. * * @param calendars the list of Calendar to calculate the minimum. * @return the minimum calendar in the Calendar list. */ public static Calendar minCalendars(List<Calendar> calendars) { long min = Long.MAX_VALUE; Calendar minCalendar = null; for (Calendar value : calendars) { long v = value.getTimeInMillis(); if (v < min) { min = v; minCalendar = value; } } return minCalendar; } }