Language

OffsetTime.CompareTo(OffsetTime) Method

Definition

Compares this OffsetTime to another time.

[Android.Runtime.Register("compareTo", "(Ljava/time/OffsetTime;)I", "", ApiSince=26)]
public int CompareTo(Java.Time.OffsetTime? other);
[<Android.Runtime.Register("compareTo", "(Ljava/time/OffsetTime;)I", "", ApiSince=26)>]
member this.CompareTo : Java.Time.OffsetTime -> int

Parameters

other
OffsetTime

the other time to compare to, not null

Returns

A negative value, zero, or a positive value according to the ordering described in the remarks.

Attributes

Remarks

Compares this OffsetTime to another time. The comparison first orders the instants obtained by applying both times to the same date, then compares local time if those instants are equal. It is consistent with equals, as defined by Comparable. For example, the following is the comparator order:

  1. 10:30+01:00
  2. 11:00+01:00
  3. 12:00+02:00
  4. 11:30+01:00
  5. 12:00+01:00
  6. 12:30+01:00

Values #2 and #3 represent the same instant when applied to the same date. The local time is compared to distinguish them. This step is needed to make the ordering consistent with equals(). To compare the underlying local time of two TemporalAccessor instances, use ChronoField.NANO_OF_DAY as a comparator.

Java reference for java.time.OffsetTime.compareTo.

Applies to