class InstantComparator
extends java.lang.Object
implements java.util.Comparator<java.time.Instant>
Instant
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 and Description |
---|
InstantComparator() |
Modifier and Type | Method and Description |
---|---|
int |
compare(java.time.Instant a,
java.time.Instant b) |
int |
compare(java.time.Instant a,
java.time.Instant b,
boolean forceSecondsOnly)
Compares two
Instant s to the lower resolution of the two
instants. |
public int compare(java.time.Instant a, java.time.Instant b)
compare
in interface java.util.Comparator<java.time.Instant>
public int compare(java.time.Instant a, java.time.Instant b, boolean forceSecondsOnly)
Instant
s to the lower resolution of the two
instants. See InstantComparator
.a
- first Instant
to compareb
- second Instant
to compareforceSecondsOnly
- whether to omit all fraction comparison