Check that date is within a given range of date inclusive
date, java, range
Solution
You can avoid the `equals` checks by checking that the given date is not before or after the range :
if (!dateToCheck.before (startDate) && !dateToCheck.after (endDate))
Problem
This question is to compare dates inclusively in Java. Is there a better way to check if a given date is within a range inclusively? ``` Date startDate, endDate, dateToCheck; if ( dateToCheck.equals(startDate) || dateToCheck.equals(endDate) || (dateToCheck.after(startDate) && dateToCheck.before(endDate) ) ```