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 forInstants. 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 intcompare(java.time.Instant a, java.time.Instant b)intcompare(java.time.Instant a, java.time.Instant b, boolean forceSecondsOnly)Compares twoInstants to the lower resolution of the two instants.
-
-
-
Method Detail
-
compare
public int compare(java.time.Instant a, java.time.Instant b)- Specified by:
comparein interfacejava.util.Comparator<java.time.Instant>
-
compare
public int compare(java.time.Instant a, java.time.Instant b, boolean forceSecondsOnly)Compares twoInstants to the lower resolution of the two instants. SeeInstantComparator.- Parameters:
a- firstInstantto compareb- secondInstantto 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
-
-