mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#919 - io.ebean package initial
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
package io.ebeaninternal.server.query;
|
||||
|
||||
import io.ebean.Version;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Comparator;
|
||||
|
||||
/**
|
||||
* Compare Version beans in descending order with nulls last.
|
||||
*/
|
||||
class OrderVersionDesc implements Comparator<Version<?>> {
|
||||
|
||||
static final OrderVersionDesc INSTANCE = new OrderVersionDesc();
|
||||
|
||||
@Override
|
||||
public int compare(Version<?> o1, Version<?> o2) {
|
||||
|
||||
Timestamp v1 = o1.getStart();
|
||||
if (v1 == null) {
|
||||
return 1;
|
||||
}
|
||||
Timestamp v2 = o2.getStart();
|
||||
if (v2 == null) {
|
||||
return -1;
|
||||
}
|
||||
return v1.compareTo(v2) * -1;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user