我有这个代码:
private Range<LocalDate> datesRange;
和
intersection = !this.datesRange.isConnected(otherConditionBl.datesRange) ?
null :
this.datesRange.intersection(otherConditionBl.datesRange);
这个输入怎么会有交集?
this.datesRange = {Range@5802} "[2017-04-11..2017-04-12)"
otherConditionBl.datesRange = {Range@5801} "[2017-04-12..2017-04-14]"
this.datesRange.intersection(otherConditionBl.datesRange) = {Range@7036} "[2017-04-12..2017-04-12)"
我可以在哪里报告此错误?
最佳答案
The resulting range may be empty; for example, [1..5) intersected with [5..7) yields the empty range [5..5)
如果仔细观察,返回的范围实际上是空的。它由所有日期 x
组成,例如 2017-04-12
≤ x
<2017-04-12
,这是不可能满足的。
关于java 包 com.google.common.collect.Range< LocalDate > 交集返回错误的交集,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43354567/