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

x33g5p2x  于2022-01-24 转载在 其他  
字(5.9k)|赞(0)|评价(0)|浏览(144)

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

LocalDate.equals介绍

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

Compares this LocalDate with another ensuring that the date is the same.

Only objects of type LocalDate are compared, other types return false. To compare the dates of two TemporalAccessor instances, including dates in two different chronologies, use ChronoField#EPOCH_DAY as a comparator.
[中]检查此日期是否等于其他日期。
将此LocalDate与另一个LocalDate进行比较,确保日期相同。
仅比较LocalDate类型的对象,其他类型返回false。要比较两个TemporalAccessor实例的日期,包括两个不同年表中的日期,请使用ChronoField#EPOCH(纪元)DAY作为比较器。

代码示例

代码示例来源:origin: prolificinteractive/material-calendarview

@Override public boolean equals(Object o) {
 return o instanceof CalendarDay && date.equals(((CalendarDay) o).getDate());
}

代码示例来源:origin: prolificinteractive/material-calendarview

/**
 * Clear the previous selection, select the range of days from first to last, and finally
 * invalidate. First day should be before last day, otherwise the selection won't happen.
 *
 * @param first The first day of the range.
 * @param last The last day in the range.
 * @see CalendarPagerAdapter#setDateSelected(CalendarDay, boolean)
 */
public void selectRange(final CalendarDay first, final CalendarDay last) {
 selectedDates.clear();
 // Copy to start from the first day and increment
 LocalDate temp = LocalDate.of(first.getYear(), first.getMonth(), first.getDay());
 // for comparison
 final LocalDate end = last.getDate();
 while( temp.isBefore(end) || temp.equals(end) ) {
  selectedDates.add(CalendarDay.from(temp));
  temp = temp.plusDays(1);
 }
 invalidateSelectedDates();
}

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

@Override  // override for performance
public boolean equals(Object obj) {
  if (this == obj) {
    return true;
  }
  if (obj instanceof JapaneseDate) {
    JapaneseDate otherDate = (JapaneseDate) obj;
    return this.isoDate.equals(otherDate.isoDate);
  }
  return false;
}

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

@Override  // override for performance
public boolean equals(Object obj) {
  if (this == obj) {
    return true;
  }
  if (obj instanceof MinguoDate) {
    MinguoDate otherDate = (MinguoDate) obj;
    return this.isoDate.equals(otherDate.isoDate);
  }
  return false;
}

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

@Override  // override for performance
public boolean equals(Object obj) {
  if (this == obj) {
    return true;
  }
  if (obj instanceof MinguoDate) {
    MinguoDate otherDate = (MinguoDate) obj;
    return this.isoDate.equals(otherDate.isoDate);
  }
  return false;
}

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

@Override  // override for performance
public boolean equals(Object obj) {
  if (this == obj) {
    return true;
  }
  if (obj instanceof ThaiBuddhistDate) {
    ThaiBuddhistDate otherDate = (ThaiBuddhistDate) obj;
    return this.isoDate.equals(otherDate.isoDate);
  }
  return false;
}

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

@Override  // override for performance
public boolean equals(Object obj) {
  if (this == obj) {
    return true;
  }
  if (obj instanceof ThaiBuddhistDate) {
    ThaiBuddhistDate otherDate = (ThaiBuddhistDate) obj;
    return this.isoDate.equals(otherDate.isoDate);
  }
  return false;
}

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

@Override  // override for performance
public boolean equals(Object obj) {
  if (this == obj) {
    return true;
  }
  if (obj instanceof JapaneseDate) {
    JapaneseDate otherDate = (JapaneseDate) obj;
    return this.isoDate.equals(otherDate.isoDate);
  }
  return false;
}

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

private MinguoDate with(LocalDate newDate) {
  return (newDate.equals(isoDate) ? this : new MinguoDate(newDate));
}

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

private ThaiBuddhistDate with(LocalDate newDate) {
  return (newDate.equals(isoDate) ? this : new ThaiBuddhistDate(newDate));
}

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

private ThaiBuddhistDate with(LocalDate newDate) {
  return (newDate.equals(isoDate) ? this : new ThaiBuddhistDate(newDate));
}

代码示例来源:origin: shrikanth7698/Collapsible-Calendar-View-Android

public boolean isSelectedDay(@NonNull LocalDate day) {
  return day.equals(getSelectedItem());
}

代码示例来源:origin: shrikanth7698/Collapsible-Calendar-View-Android

public boolean isToady(@NonNull LocalDate day) {
  return LocalDate.now().equals(day);
}

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

private JapaneseDate with(LocalDate newDate) {
  return (newDate.equals(isoDate) ? this : new JapaneseDate(newDate));
}

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

private JapaneseDate with(LocalDate newDate) {
  return (newDate.equals(isoDate) ? this : new JapaneseDate(newDate));
}

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

private MinguoDate with(LocalDate newDate) {
  return (newDate.equals(isoDate) ? this : new MinguoDate(newDate));
}

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

/**
 * Checks if this date-time is equal to another date-time.
 * <p>
 * Compares this {@code LocalDateTime} with another ensuring that the date-time is the same.
 * Only objects of type {@code LocalDateTime} are compared, other types return false.
 *
 * @param obj  the object to check, null returns false
 * @return true if this is equal to the other date-time
 */
@Override
public boolean equals(Object obj) {
  if (this == obj) {
    return true;
  }
  if (obj instanceof LocalDateTime) {
    LocalDateTime other = (LocalDateTime) obj;
    return date.equals(other.date) && time.equals(other.time);
  }
  return false;
}

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

/**
 * Checks if this date-time is equal to another date-time.
 * <p>
 * Compares this {@code LocalDateTime} with another ensuring that the date-time is the same.
 * Only objects of type {@code LocalDateTime} are compared, other types return false.
 *
 * @param obj  the object to check, null returns false
 * @return true if this is equal to the other date-time
 */
@Override
public boolean equals(Object obj) {
  if (this == obj) {
    return true;
  }
  if (obj instanceof LocalDateTime) {
    LocalDateTime other = (LocalDateTime) obj;
    return date.equals(other.date) && time.equals(other.time);
  }
  return false;
}

代码示例来源:origin: com.torodb.torod/torod-core

@Override
public boolean equals(Object obj) {
  if (obj == this) {
    return true;
  }
  if (obj == null) {
    return false;
  }
  if (!(obj instanceof ScalarDate)) {
    return false;
  }
  ScalarDate other = (ScalarDate) obj;
  return this.getValue().equals(other.getValue());
}

代码示例来源:origin: com.torodb.kvdocument/kvdocument-core

@Override
public boolean equals(Object obj) {
  if (obj == this) {
    return true;
  }
  if (obj == null) {
    return false;
  }
  if (!(obj instanceof KVDate)) {
    return false;
  }
  KVDate other = (KVDate) obj;
  return this.getValue().equals(other.getValue());
}

相关文章