Below is my code, I get the keys of my Map and then I iterate through them in order to get the last date, However it does not appear to get the last date. The values on this line Set<Date> keys = date.keySet();
are 10.31.18 and 11.17.18. I would expect lastDate to equal 11.17.18 however it equals 10.31.18. Any ideas what I am doing wrong here.
Map<Date, List<Integer>> date = date(dates, noPupils);
Set<Date> keys = date.keySet();
for (Iterator<Date> it = keys.iterator(); it.hasNext();) {
while (it.hasNext()) {
Date lastDate = it.next();