org.joda.time.LocalDateTime.compareTo()方法的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(2.6k)|赞(0)|评价(0)|浏览(168)

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

LocalDateTime.compareTo介绍

[英]Compares this partial with another returning an integer indicating the order.

The fields are compared in order, from largest to smallest. The first field that is non-equal is used to determine the result.

The specified object must be a partial instance whose field types match those of this partial.

NOTE: This implementation violates the Comparable contract. This method will accept any instance of ReadablePartial as input. However, it is possible that some implementations of ReadablePartial exist that do not extend AbstractPartial, and thus will throw a ClassCastException if compared in the opposite direction. The cause of this problem is that ReadablePartial doesn't define the compareTo() method, however we can't change that until v2.0.
[中]将此部分与另一个返回指示顺序的整数的部分进行比较。
字段按从最大到最小的顺序进行比较。第一个不相等的字段用于确定结果。
指定的对象必须是其字段类型与此分部的字段类型匹配的分部实例。
注:此实施违反了可比合同。此方法将接受ReadablePartial的任何实例作为输入。但是,ReadablePartial的某些实现可能不扩展AbstractPartial,因此如果在相反方向进行比较,则会抛出ClassCastException。这个问题的原因是ReadablePartial没有定义compareTo()方法,但是在v2之前我们无法更改它。0

代码示例

代码示例来源:origin: effektif/effektif

public boolean isDue() {
 return dueDate ==null || dueDate.compareTo(Time.now())<=0;
}

代码示例来源:origin: org.kuali.kpme/kpme-tk-lm-impl

for (LocalDateTime currentDate = startDate; currentDate.compareTo(endDate) < 0; currentDate = currentDate.plusDays(1)) {

代码示例来源:origin: org.kuali.kpme/kpme-tk-lm-impl

int index = 0;
for (LocalDateTime leaveSummaryDate : leaveSummaryDates) {
  if(leaveSummaryDate.compareTo(beginDate.toLocalDateTime()) >= 0 && leaveSummaryDate.compareTo(endDate.toLocalDateTime())<=0) {
    acDayDetails.add(index, null);
    if (accrualCategoryLeaveHours.get(leaveSummaryDate) != null) {

代码示例来源:origin: org.kuali.kpme/kpme-tk-lm-impl

LocalDateTime weekEnd = actualStartDate;
Set<LocalDateTime> dates = new TreeSet<LocalDateTime>();
for (LocalDateTime currentDate = actualStartDate; currentDate.compareTo(actualEndDate) <= 0; currentDate = currentDate.plusDays(1)) {
      || currentDate.compareTo(actualEndDate) == 0) {
    String weekString = "Week " + week;
    StringBuilder display = new StringBuilder();
    display.append(endDateString);
    weekDates.put(weekString, display.toString());
    if(currentDate.compareTo(actualEndDate) == 0) {
      dates.add(currentDate);
  if(weekStart.compareTo(endDate) < 0) {
    StringBuilder display = new StringBuilder();

代码示例来源:origin: org.kuali.kpme/kpme-tk-lm-impl

for (LocalDateTime currentDate = actualStartDate; currentDate.compareTo(actualEndDate) < 0; currentDate = currentDate.plusDays(1)) {

相关文章