本文整理了Java中java.time.OffsetDateTime.isEqual()
方法的一些代码示例,展示了OffsetDateTime.isEqual()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。OffsetDateTime.isEqual()
方法的具体详情如下:
包路径:java.time.OffsetDateTime
类名称:OffsetDateTime
方法名:isEqual
[英]Checks if the instant of this date-time is equal to that of the specified date-time.
This method differs from the comparison in #compareTo and #equalsin that it only compares the instant of the date-time. This is equivalent to using dateTime1.toInstant().equals(dateTime2.toInstant());.
[中]检查此日期时间的瞬间是否等于指定日期时间的瞬间。
这种方法不同于#compareTo和#equals的比较,它只比较日期和时间的瞬间。这相当于使用dateTime1。toInstant()。等于(dateTime2.toInstant());。
代码示例来源:origin: jdbi/jdbi
@Test
public void offsetDateTimeLosesOffset() {
OffsetDateTime dt = OffsetDateTime.now().withOffsetSameInstant(ZoneOffset.ofHours(-7));
h.execute("insert into stuff(ts) values (?)", dt);
assertThat(h.createQuery("select ts from stuff").mapTo(OffsetDateTime.class).findOnly().isEqual(dt)).isTrue();
}
代码示例来源:origin: jdbi/jdbi
@Test
public void offsetDateTimeLosesOffset() {
OffsetDateTime dt = OffsetDateTime.now().withOffsetSameInstant(ZoneOffset.ofHours(-7));
h.execute("insert into stuff(ts) values (?)", dt);
assertThat(dt.isEqual(h.createQuery("select ts from stuff").mapTo(OffsetDateTime.class).findOnly())).isTrue();
}
代码示例来源:origin: fabienrenaud/java-json-benchmark
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof Partner)) return false;
Partner partner = (Partner) o;
if (id != partner.id) return false;
if (since == null && partner.since != null || since != null && !since.isEqual(partner.since)) return false;
return name != null ? name.equals(partner.name) : partner.name == null;
}
代码示例来源:origin: Silverpeas/Silverpeas-Core
private static void checkPeriod(final OffsetDateTime startDateTime,
final OffsetDateTime endDateTime) {
Objects.requireNonNull(startDateTime);
Objects.requireNonNull(endDateTime);
if (startDateTime.isAfter(endDateTime) || startDateTime.isEqual(endDateTime)) {
throw new IllegalArgumentException("The end datetime must be after the start datetime");
}
}
代码示例来源:origin: jneat/mybatis-types
@Test(priority = 1, dataProvider = "date")
public void dateGet(long id, LocalDateTime localdt, OffsetDateTime offsetdt, ZonedDateTime zoneddt) {
TimeRow row = mapper.get(id);
if (id % 10 == 0) {
assertThat(row.getLocaldt()).isNull();
assertThat(row.getOffsetdt()).isNull();
assertThat(row.getZoneddt()).isNull();
} else {
assertThat(row.getLocaldt()).isEqualTo(localdt);
assertThat(row.getOffsetdt().isEqual(offsetdt)).isTrue();
assertThat(row.getZoneddt().isEqual(zoneddt)).isTrue();
}
}
内容来源于网络,如有侵权,请联系作者删除!