All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.ebeaninternal.server.query.OrderVersionDesc Maven / Gradle / Ivy

There is a newer version: 15.8.0
Show newest version
package io.ebeaninternal.server.query;

import io.ebean.Version;

import java.io.Serializable;
import java.sql.Timestamp;
import java.util.Comparator;

/**
 * Compare Version beans in descending order with nulls last.
 */
final class OrderVersionDesc implements Comparator>, Serializable {

  static final OrderVersionDesc INSTANCE = new OrderVersionDesc();

  private static final long serialVersionUID = -3681686029998263310L;

  @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;
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy