org.threeten.bp.Instant.compareTo()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(3.2k)|赞(0)|评价(0)|浏览(182)

本文整理了Java中org.threeten.bp.Instant.compareTo()方法的一些代码示例,展示了Instant.compareTo()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Instant.compareTo()方法的具体详情如下:
包路径:org.threeten.bp.Instant
类名称:Instant
方法名:compareTo

Instant.compareTo介绍

[英]Compares this instant to the specified instant.

The comparison is based on the time-line position of the instants. It is "consistent with equals", as defined by Comparable.
[中]将此瞬间与指定瞬间进行比较。
比较是基于瞬间的时间线位置。它是“与相等一致的”,如Comparable所定义。

代码示例

代码示例来源:origin: JakeWharton/u2020

@Override public int compareAsc(@NonNull Repository lhs, @NonNull Repository rhs) {
  return lhs.updated_at.compareTo(rhs.updated_at);
 }
}

代码示例来源:origin: googleapis/google-cloud-java

@Override
 public int compareTo(PendingCallable<T> other) {
  return getScheduledTime().compareTo(other.getScheduledTime());
 }
}

代码示例来源:origin: ThreeTen/threetenbp

/**
 * Checks if this instant is after the specified instant.
 * <p>
 * The comparison is based on the time-line position of the instants.
 *
 * @param otherInstant  the other instant to compare to, not null
 * @return true if this instant is after the specified instant
 * @throws NullPointerException if otherInstant is null
 */
public boolean isAfter(Instant otherInstant) {
  return compareTo(otherInstant) > 0;
}

代码示例来源:origin: ThreeTen/threetenbp

/**
 * Checks if this instant is before the specified instant.
 * <p>
 * The comparison is based on the time-line position of the instants.
 *
 * @param otherInstant  the other instant to compare to, not null
 * @return true if this instant is before the specified instant
 * @throws NullPointerException if otherInstant is null
 */
public boolean isBefore(Instant otherInstant) {
  return compareTo(otherInstant) < 0;
}

代码示例来源:origin: org.threeten/threetenbp

/**
 * Checks if this instant is before the specified instant.
 * <p>
 * The comparison is based on the time-line position of the instants.
 *
 * @param otherInstant  the other instant to compare to, not null
 * @return true if this instant is before the specified instant
 * @throws NullPointerException if otherInstant is null
 */
public boolean isBefore(Instant otherInstant) {
  return compareTo(otherInstant) < 0;
}

代码示例来源:origin: org.threeten/threetenbp

/**
 * Checks if this instant is after the specified instant.
 * <p>
 * The comparison is based on the time-line position of the instants.
 *
 * @param otherInstant  the other instant to compare to, not null
 * @return true if this instant is after the specified instant
 * @throws NullPointerException if otherInstant is null
 */
public boolean isAfter(Instant otherInstant) {
  return compareTo(otherInstant) > 0;
}

代码示例来源:origin: ThreeTen/threetenbp

/**
 * Compares this transition to another based on the transition instant.
 * <p>
 * This compares the instants of each transition.
 * The offsets are ignored, making this order inconsistent with equals.
 *
 * @param transition  the transition to compare to, not null
 * @return the comparator value, negative if less, positive if greater
 */
@Override
public int compareTo(ZoneOffsetTransition transition) {
  return this.getInstant().compareTo(transition.getInstant());
}

代码示例来源:origin: org.threeten/threetenbp

/**
 * Compares this transition to another based on the transition instant.
 * <p>
 * This compares the instants of each transition.
 * The offsets are ignored, making this order inconsistent with equals.
 *
 * @param transition  the transition to compare to, not null
 * @return the comparator value, negative if less, positive if greater
 */
@Override
public int compareTo(ZoneOffsetTransition transition) {
  return this.getInstant().compareTo(transition.getInstant());
}

相关文章