This could be a possible duplicate question but still asking.
I have a list of date (dates are in unsorted)
1/5/2012,1/10/2012, 1/1/2012, 1/7/2012 (MM/dd/yyyy)( only date no timestamp)
First I sorted all dates using collections ref
Collections.sort(listOfDates);
Now listOfDates Contains dates in order. 1/1/2012, 1/5/2012, 1/7/2012, 1/10/2012
How can i get all missing dates from the sorted list?
missing dates - 1/2/2012 1/3/2012 1/4/2012 1/6/2012 1/8/2012 1/9/2012
I have a sample program , but not sure how to get it working with the above requirement
Sample Algo taken from this question
if (listOfDates!=null && !listOfDates.isEmpty()) {
Date firstDate = listOfDates.get(0) //contains the start date
Date lastDate = listOfDates.get(listOfDates.size()-1); //contains end date
}