org.threeten.extra.YearQuarter.isBefore()方法的使用及代码示例

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

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

YearQuarter.isBefore介绍

[英]Is this year-quarter before the specified year-quarter.
[中]是指定年度季度之前的本年度季度。

代码示例

代码示例来源:origin: hibernate/hibernate-demos

public boolean isValid(YearQuarter value, ConstraintValidatorContext context) {
    if ( value == null ) {
      return true;
    }
    return YearQuarter.now().isBefore( value );
  }
}

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

/**
 * Returns a sequential ordered stream of year-quarter. The returned stream starts from this year-quarter
 * (inclusive) and goes to {@code endExclusive} (exclusive) by an incremental step of 1 {@code QUARTER_YEARS}.
 * <p>
 * This instance is immutable and unaffected by this method call.
 * 
 * @param endExclusive  the end year-quarter, exclusive, not null
 * @return a sequential {@code Stream} for the range of {@code YearQuarter} values
 * @throws IllegalArgumentException if end year-quarter is before this year-quarter
 */
public Stream<YearQuarter> quartersUntil(YearQuarter endExclusive) {
  if (endExclusive.isBefore(this)) {
    throw new IllegalArgumentException(endExclusive + " < " + this);
  }
  long intervalLength = until(endExclusive, QUARTER_YEARS);
  return LongStream.range(0,intervalLength).mapToObj(n -> plusQuarters(n));
}

相关文章

微信公众号

最新文章

更多

YearQuarter类方法