org.hibernate.util.CalendarComparator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hibernate Show documentation
Show all versions of hibernate Show documentation
Relational Persistence for Java
//$Id: CalendarComparator.java 4496 2004-09-04 13:01:55Z oneovthafew $
package org.hibernate.util;
import java.util.Calendar;
import java.util.Comparator;
/**
* @author Gavin King
*/
public class CalendarComparator implements Comparator {
public int compare(Object x, Object y) {
Calendar xcal = (Calendar) x;
Calendar ycal = (Calendar) y;
if ( xcal.before(ycal) ) return -1;
if ( xcal.after(ycal) ) return 1;
return 0;
}
public static final Comparator INSTANCE = new CalendarComparator();
}