Class DateRange
java.lang.Object
cloud.opencode.base.date.range.DateRange
@Deprecated(since="1.0.0",
forRemoval=false)
public final class DateRange
extends Object
implements Iterable<LocalDate>
Deprecated.
DateRange - Compatibility wrapper for LocalDateRange
日期范围 - LocalDateRange的兼容性包装器
This class provides a compatibility layer for the extra.LocalDateRange class, offering the same functionality with a simpler name for legacy code compatibility.
此类为extra.LocalDateRange类提供兼容层,使用更简单的名称以兼容遗留代码。
Features | 主要功能:
- Compatibility wrapper for LocalDateRange - LocalDateRange的兼容性包装器
- Date iteration and streaming - 日期迭代和流式处理
- Containment and overlap checking - 包含和重叠检查
- Split by week/month - 按周/月分割
Usage Examples | 使用示例:
DateRange range = DateRange.of(LocalDate.of(2024, 1, 1), LocalDate.of(2024, 12, 31));
long days = range.lengthInDays();
for (LocalDate date : range) {
System.out.println(date);
}
Security | 安全性:
- Thread-safe: Yes (immutable, delegates to immutable LocalDateRange) - 线程安全: 是(不可变,委托给不可变的LocalDateRange)
- Null-safe: No (delegates null handling to LocalDateRange) - 空值安全: 否(空值处理委托给LocalDateRange)
- Since:
- JDK 25, opencode-base-date V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionbooleanDeprecated.static DateRangeempty()Deprecated.Creates an empty DateRange 创建空日期范围booleanDeprecated.booleanDeprecated.static DateRangefrom(LocalDateRange range) Deprecated.Creates a DateRange from a LocalDateRange 从LocalDateRange创建DateRangegetEnd()Deprecated.getStart()Deprecated.inthashCode()Deprecated.intersection(DateRange other) Deprecated.booleanisConnected(DateRange other) Deprecated.booleanisEmpty()Deprecated.iterator()Deprecated.longDeprecated.static DateRangeDeprecated.Creates a DateRange (inclusive on both ends) 创建日期范围(两端都包含)static DateRangeofExclusive(LocalDate start, LocalDate endExclusive) Deprecated.Creates a DateRange (exclusive end) 创建日期范围(不包含结束日期)booleanDeprecated.Deprecated.Deprecated.Deprecated.stream()Deprecated.Deprecated.toList()Deprecated.Deprecated.Converts to LocalDateRange 转换为LocalDateRangetoString()Deprecated.Methods inherited from interface Iterable
forEach, spliterator
-
Method Details
-
of
-
ofExclusive
-
empty
Deprecated.Creates an empty DateRange 创建空日期范围- Returns:
- empty DateRange | 空日期范围
-
from
Deprecated.Creates a DateRange from a LocalDateRange 从LocalDateRange创建DateRange- Parameters:
range- the LocalDateRange | LocalDateRange- Returns:
- the DateRange | 日期范围
-
getStart
Deprecated. -
getEnd
Deprecated. -
lengthInDays
public long lengthInDays()Deprecated. -
isEmpty
public boolean isEmpty()Deprecated. -
contains
Deprecated. -
encloses
Deprecated. -
overlaps
Deprecated. -
isConnected
Deprecated. -
intersection
-
span
-
iterator
-
stream
-
stream
-
toList
-
splitByWeek
-
splitByMonth
-
toLocalDateRange
Deprecated.Converts to LocalDateRange 转换为LocalDateRange- Returns:
- the LocalDateRange | LocalDateRange
-
equals
-
hashCode
-
toString
-
LocalDateRangeinstead