Java Reference
In-Depth Information
iif ( month > a2 . month )
return
return + 1 ;
iif ( day < a2 . day )
return
return - 1 ;
iif ( day > a2 . day )
return
return + 1 ;
iif ( hour < a2 . hour )
return
return - 1 ;
iif ( hour > a2 . hour )
return
return + 1 ;
iif ( minute < a2 . minute )
return
return - 1 ;
iif ( minute > a2 . minute )
return
return + 1 ;
return
return text . compareTo ( a2 . text );
}
/** Compare this appointment against another, for equality.
* Consistent with compareTo(). For this reason, only
* text, date & time participate, not repetition.
* @returns true if the objects are equal, false if not.
*/
@Override
public
public boolean
boolean equals ( Object o2 ) {
Appt a2 = ( Appt ) o2 ;
iif ( year != a2 . year ||
month != a2 . month ||
day != a2 . day ||
hour != a2 . hour ||
minute != a2 . minute )
return
return false
false ;
return
return text . equals ( a2 . text );
}
If you're still confused between Comparable and Comparator , you're probably not alone.
Table 7-3 summarizes the two “comparison” interfaces.
Search WWH ::




Custom Search