java.time.LocalDate
Meanwhile you are probably working with Java 8 LocalDateThe (instead ofjava.util.Date
& java.sql.Date
classes were supplanted by the old java.utiljava.time classes defined in JSR 310.Date)
For Java 8 LocalDateand later, use this method toLocalDate
for a date-only value.
To get the earliest of a list of dates:
import java.time.LocalDate;
public static LocalDate earliestDate(LocalDate... dates) {
return
Arrays
.stream(dates)
.filter(Objects::nonNull)
.min(LocalDate::compareTo)
.orElse(null);
}