fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.time.*;
  5.  
  6. /* Name of the class has to be "Main" only if the class is public. */
  7. class Ideone
  8. {
  9. public static void main (String[] args) throws java.lang.Exception
  10. {
  11. List<LocalDate> dates = Arrays.asList(
  12. LocalDate.of(2019, Month.FEBRUARY, 6),
  13. LocalDate.of(2018, Month.DECEMBER, 24),
  14. LocalDate.of(2018, Month.DECEMBER, 25),
  15. LocalDate.of(2018, Month.NOVEMBER, 6));
  16. dates.sort(Comparator.naturalOrder());
  17. dates.forEach(System.out::println);
  18. }
  19. }
Success #stdin #stdout 0.14s 2184192KB
stdin
Standard input is empty
stdout
2018-11-06
2018-12-24
2018-12-25
2019-02-06