指定された日付に最も近い日付を取得する方法を入力する方法を知りたいと思っていました。私が意味するのは、次のようなものです。
public Date getNearestDate(List<Date> dates, Date currentDate) {
return closestDate // The date that is the closest to the currentDate;
}
同様の質問を見つけましたが、良い答えが得られたのは1つだけで、コードからNullPointerExceptionsが返され続けました...誰か助けてくれますか?