public class JodaUtils extends Object
| Modifier and Type | Field and Description |
|---|---|
static long |
MAX_INSTANT |
static long |
MIN_INSTANT |
| Constructor and Description |
|---|
JodaUtils() |
| Modifier and Type | Method and Description |
|---|---|
static Iterator<org.joda.time.Interval> |
condensedIntervalsIterator(Iterator<org.joda.time.Interval> sortedIntervals)
Condense the provided intervals such that the returned list has no abutting intervals, no overlapping intervals,
and no zero-length intervals.
|
static List<org.joda.time.Interval> |
condenseIntervals(Iterable<org.joda.time.Interval> intervals)
Condense the provided intervals such that the returned list has no abutting intervals, no overlapping intervals,
and no zero-length intervals.
|
static org.joda.time.DateTime |
maxDateTime(org.joda.time.DateTime... times) |
static org.joda.time.DateTime |
minDateTime(org.joda.time.DateTime... times) |
static org.joda.time.Interval |
umbrellaInterval(Iterable<org.joda.time.Interval> intervals) |
public static final long MAX_INSTANT
public static final long MIN_INSTANT
public static List<org.joda.time.Interval> condenseIntervals(Iterable<org.joda.time.Interval> intervals)
This method is most efficient if the input intervals are in a SortedSet whose comparator is
Comparators.intervalsByStartThenEnd().
intervals - The Iterable object containing the intervals to condensepublic static Iterator<org.joda.time.Interval> condensedIntervalsIterator(Iterator<org.joda.time.Interval> sortedIntervals)
The provided intervals must be sorted in ascending order using Comparators.intervalsByStartThenEnd().
Otherwise, results are undefined.
The method avoids materialization by incrementally condensing the intervals by starting from the first and looking for "adjacent" intervals. This is possible since intervals in the Iterator are in ascending order (as guaranteed by the caller).
sortedIntervals - The iterator object containing the intervals to condenseIAE - if an element is null or if sortedIntervals is not sorted in ascending orderpublic static org.joda.time.Interval umbrellaInterval(Iterable<org.joda.time.Interval> intervals)
public static org.joda.time.DateTime minDateTime(org.joda.time.DateTime... times)
public static org.joda.time.DateTime maxDateTime(org.joda.time.DateTime... times)
Copyright © 2011–2023 The Apache Software Foundation. All rights reserved.