java.time.ZonedDateTime.equals()方法的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(6.1k)|赞(0)|评价(0)|浏览(118)

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

ZonedDateTime.equals介绍

[英]Checks if this date-time is equal to another date-time.

The comparison is based on the offset date-time and the zone. Only objects of type ZonedDateTime are compared, other types return false.
[中]检查此日期时间是否等于另一个日期时间。
比较基于偏移日期时间和区域。仅比较ZonedDateTime类型的对象,其他类型返回false。

代码示例

代码示例来源:origin: chewiebug/GCViewer

@Override
public boolean equals(Object o) {
  if (this == o)
    return true;
  if (o == null || getClass() != o.getClass())
    return false;
  GcDateStamp that = (GcDateStamp) o;
  return time != null ? time.equals(that.time) : that.time == null;
}

代码示例来源:origin: prestodb/presto

@Override
  public ConnectorPageSource createPageSource(
      ConnectorTransactionHandle transactionHandle,
      ConnectorSession session,
      ConnectorSplit split,
      List<ColumnHandle> columns)
  {
    AtopSplit atopSplit = (AtopSplit) split;

    ImmutableList.Builder<Type> types = ImmutableList.builder();
    ImmutableList.Builder<AtopColumn> atopColumns = ImmutableList.builder();

    for (ColumnHandle column : columns) {
      AtopColumnHandle atopColumnHandle = (AtopColumnHandle) column;
      AtopColumn atopColumn = atopSplit.getTable().getColumn(atopColumnHandle.getName());
      atopColumns.add(atopColumn);
      types.add(typeManager.getType(atopColumn.getType()));
    }

    ZonedDateTime date = atopSplit.getDate();
    checkArgument(date.equals(date.withHour(0).withMinute(0).withSecond(0).withNano(0)), "Expected date to be at beginning of day");
    return new AtopPageSource(readerPermits, atopFactory, session, utf8Slice(atopSplit.getHost().getHostText()), atopSplit.getTable(), date, atopColumns.build(), types.build());
  }
}

代码示例来源:origin: sdl/odata

private boolean areDatesEqual(ZonedDateTime that) {
  if (dateTime == null && that == null) {
    return true;
  }
  if (dateTime != null && that != null) {
    return dateTime.equals(that);
  }
  return false;
}

代码示例来源:origin: com.sdl/odata_test

private boolean areDatesEqual(ZonedDateTime that) {
  if (dateTime == null && that == null) {
    return true;
  }
  if (dateTime != null && that != null) {
    return dateTime.equals(that);
  }
  return false;
}

代码示例来源:origin: com.arakelian/faker

private boolean equalTo(ImmutableAddress another) {
 return city.equals(another.city)
   && postalCode.equals(another.postalCode)
   && state.equals(another.state)
   && street.equals(another.street)
   && created.equals(another.created)
   && id.equals(another.id)
   && updated.equals(another.updated);
}

代码示例来源:origin: com.guestful.module/guestful.module.jsr310-extensions

@Override
public boolean equals(Object o) {
  if (this == o) return true;
  if (o == null || getClass() != o.getClass()) return false;
  ZonedInterval that = (ZonedInterval) o;
  return start.equals(that.start) && end.equals(that.end) && zoneId.equals(that.zoneId);
}

代码示例来源:origin: stackoverflow.com

ZoneId zid = ZoneId.of("America/New_York");
ZoneOffset offset = ZoneOffset.from(LocalDateTime.now().atZone(zid));
ZonedDateTime zdt0 = ZonedDateTime.of(2014, 8, 24, 21, 10, 1, 777000002, offset);
ZonedDateTime zdt1 = ZonedDateTime.of(2014, 8, 24, 21, 10, 1, 777000002, zid);
System.out.println("isEqual:" + zdt0.isEqual(zdt1));
System.out.println("equals: " + zdt0.equals(zdt1));

代码示例来源:origin: UniversaBlockchain/universa

public StateRecord setExpiresAt(@NonNull ZonedDateTime expiresAt) {
  if( !this.expiresAt.equals(expiresAt) ) {
    this.expiresAt = expiresAt;
    dirty = true;
  }
  return this;
}

代码示例来源:origin: com.addthis/cronus

private ScheduledFuture<?> submitToExecutor(CronRunnable cronRunnable, boolean inclusive) {
  ZonedDateTime now = ZonedDateTime.now();
  ZonedDateTime next = cronRunnable.pattern.next(now, inclusive);
  long delta;
  if (now.equals(next)) {
    delta = 0;
  } else {
    Duration difference = Duration.between(now, next);
    delta = difference.toNanos();
  }
  return executor.schedule(cronRunnable, delta, TimeUnit.NANOSECONDS);
}

代码示例来源:origin: org.xbib/time

@Override
public boolean equals(Object other) {
  return other instanceof RepeaterWeekend &&
      ((Repeater) other).getType().equals(getType()) &&
      ((Repeater) other).getNow().equals(getNow());
}

代码示例来源:origin: org.xbib/time

@Override
public boolean equals(Object other) {
  return other instanceof RepeaterMonthName &&
      ((Repeater) other).getType().equals(getType()) &&
      ((Repeater) other).getNow().equals(getNow());
}

代码示例来源:origin: org.xbib/time

@Override
public boolean equals(Object other) {
  return other instanceof RepeaterDayName &&
      ((Repeater) other).getType().equals(getType()) &&
      ((Repeater) other).getNow().equals(getNow());
}

代码示例来源:origin: org.xbib/time

@Override
public boolean equals(Object other) {
  return other instanceof RepeaterMonth &&
      ((Repeater) other).getType().equals(getType()) &&
      ((Repeater) other).getNow().equals(getNow());
}

代码示例来源:origin: org.xbib/time

@Override
public boolean equals(Object other) {
  return other instanceof RepeaterYear &&
      ((Repeater) other).getType().equals(getType()) &&
      ((Repeater) other).getNow().equals(getNow());
}

代码示例来源:origin: org.xbib/time

@Override
public boolean equals(Object other) {
  return other instanceof RepeaterSecond &&
      ((Repeater) other).getType().equals(getType()) &&
      ((Repeater) other).getNow().equals(getNow());
}

代码示例来源:origin: org.xbib/time

@Override
public boolean equals(Object other) {
  return other instanceof RepeaterHour &&
      ((Repeater) other).getType().equals(getType()) &&
      ((Repeater) other).getNow().equals(getNow());
}

代码示例来源:origin: org.xbib/time

@Override
public boolean equals(Object other) {
  return other instanceof RepeaterMinute &&
      ((Repeater) other).getType().equals(getType()) &&
      ((Repeater) other).getNow().equals(getNow());
}

代码示例来源:origin: org.xbib/time

@Override
public boolean equals(Object other) {
  return other instanceof RepeaterDayPortion &&
      ((Repeater) other).getType().equals(getType()) &&
      ((Repeater) other).getNow().equals(getNow());
}

代码示例来源:origin: org.xbib/time

@Override
public boolean equals(Object other) {
  return other instanceof RepeaterDay &&
      ((Repeater) other).getType().equals(getType()) &&
      ((Repeater) other).getNow().equals(getNow());
}

代码示例来源:origin: org.xbib/time

@Override
public boolean equals(Object other) {
  return other instanceof RepeaterFortnight &&
      ((Repeater) other).getType().equals(getType()) &&
      ((Repeater) other).getNow().equals(getNow());
}

相关文章

ZonedDateTime类方法