class KubernetesUtils {

  public static boolean isFirstNewer(V1ObjectMeta first, V1ObjectMeta second) {
    if (second == null) {
      return true;
    }
    if (first == null) {
      return false;
    }

    DateTime time1 = first.getCreationTimestamp();
    DateTime time2 = second.getCreationTimestamp();

    if (time1.equals(time2)) {
      return getResourceVersion(first).compareTo(getResourceVersion(second)) > 0;
    } else {
      return time1.isAfter(time2);
    }
  }

}