1176 |
return max; |
return max; |
1177 |
} |
} |
1178 |
|
|
1179 |
public int compareTo(Calendar other) |
/** |
1180 |
|
* Compares the time of two calendar instances. |
1181 |
|
* @param calendar the calendar to which the time should be compared. |
1182 |
|
* @return 0 if the two calendars are set to the same time, |
1183 |
|
* less than 0 if the time of this calendar is before that of |
1184 |
|
* <code>cal</code>, or more than 0 if the time of this calendar is after |
1185 |
|
* that of <code>cal</code>. |
1186 |
|
* |
1187 |
|
* @param cal the calendar to compare this instance with. |
1188 |
|
* @throws NullPointerException if <code>cal</code> is null. |
1189 |
|
* @throws IllegalArgumentException if either calendar has fields set to |
1190 |
|
* invalid values. |
1191 |
|
* @since 1.5 |
1192 |
|
*/ |
1193 |
|
public int compareTo(Calendar cal) |
1194 |
{ |
{ |
1195 |
if (time < other.time) |
long t1 = getTimeInMillis(); |
1196 |
return -1; |
long t2 = cal.getTimeInMillis(); |
1197 |
return time == other.time ? 0 : 1; |
if(t1 == t2) |
1198 |
|
return 0; |
1199 |
|
if(t1 > t2) |
1200 |
|
return 1; |
1201 |
|
return -1; |
1202 |
} |
} |
1203 |
|
|
1204 |
/** |
/** |