Here you can find the source of getCurrentTimeIfCalendareIsNull(Calendar testDate)
Parameter | Description |
---|---|
testDate | The date being testsed. |
public static Date getCurrentTimeIfCalendareIsNull(Calendar testDate)
//package com.java2s; import java.util.Calendar; import java.util.Date; public class Main { /**// ww w .j a v a 2 s . c om * Returns the testDate if it has a value otherwise returns the current time. * @param testDate The date being testsed. * @return the testDate if it has a value otherwise returns the current time. */ public static Date getCurrentTimeIfCalendareIsNull(Calendar testDate) { if (testDate == null) { return Calendar.getInstance().getTime(); } else { return testDate.getTime(); } } }