Java Date Time - OffsetDateTime timeLineOrder() example








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

Syntax

timeLineOrder has the following syntax.

public static Comparator<OffsetDateTime> timeLineOrder()

Example

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();
    
    System.out.println(o);
  }
}

The code above generates the following result.