Java Date Time - OffsetDateTime timeLineOrder() example

OffsetDateTime timeLineOrder() gets a comparator that compares two OffsetDateTime instances based solely on the instant.


timeLineOrder has the following syntax.

public static Comparator<OffsetDateTime> timeLineOrder()


The following example shows how to use timeLineOrder.

import java.time.OffsetDateTime;
import java.util.Comparator;
/* w w w .ja va2 s.  c  om*/
public class Main {
  public static void main(String[] args) {
    Comparator<OffsetDateTime> o = OffsetDateTime.timeLineOrder();

The code above generates the following result.