Skip to main content
Reservation from comment
Source Link
Anonymous
  • 84.5k
  • 15
  • 148
  • 170
List.of(date1, date2)
                .stream()
                .min(Date::compareTo)
                .get();

It is simple solution which I wanted to share that could be used in a private method when you are sure all dates are not null.

List.of(date1, date2)
                .stream()
                .min(Date::compareTo)
                .get();
List.of(date1, date2)
                .stream()
                .min(Date::compareTo)
                .get();

It is simple solution which I wanted to share that could be used in a private method when you are sure all dates are not null.

Source Link

List.of(date1, date2)
                .stream()
                .min(Date::compareTo)
                .get();