Package org.eclipse.jgit.treewalk
Class InstantComparator
- java.lang.Object
-
- org.eclipse.jgit.treewalk.InstantComparator
-
- All Implemented Interfaces:
java.util.Comparator<java.time.Instant>
class InstantComparator extends java.lang.Object implements java.util.Comparator<java.time.Instant>
Specialized comparator forInstant
s. If either timestamp has a zero fraction, compares only seconds. If either timestamp has no time fraction smaller than a millisecond, compares only milliseconds. If either timestamp has no fraction smaller than a microsecond, compares only microseconds.
-
-
Constructor Summary
Constructors Constructor Description InstantComparator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compare(java.time.Instant a, java.time.Instant b)
int
compare(java.time.Instant a, java.time.Instant b, boolean forceSecondsOnly)
Compares twoInstant
s to the lower resolution of the two instants.
-
-
-
Method Detail
-
compare
public int compare(java.time.Instant a, java.time.Instant b)
- Specified by:
compare
in interfacejava.util.Comparator<java.time.Instant>
-
compare
public int compare(java.time.Instant a, java.time.Instant b, boolean forceSecondsOnly)
Compares twoInstant
s to the lower resolution of the two instants. SeeInstantComparator
.- Parameters:
a
- firstInstant
to compareb
- secondInstant
to compareforceSecondsOnly
- whether to omit all fraction comparison- Returns:
- a value < 0 if a < b, a value > 0 if a > b, and 0 if a == b
-
-