I can't figure out why the last condition is not met.
package com.codegym.task.task08.task0816;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Locale;
/*
Kind Emma and the summer holidays
*/
public class Solution {
public static HashMap<String, Date> createMap() throws ParseException {
DateFormat df = new SimpleDateFormat("MMMMM d yyyy", Locale.ENGLISH);
HashMap<String, Date> map = new HashMap<String, Date>();
map.put("Stallone", df.parse("JUNE 1 1980"));
map.put("Johnson", df.parse("JULY 7 1985"));
map.put("Smith", df.parse("JUNE 8 1982"));
map.put("Mullen", df.parse("JULY 2 1987"));
map.put("Humphreys", df.parse("JULY 3 1986"));
map.put("Keating", df.parse("JUNE 4 1987"));
map.put("Gangiyani", df.parse("APRIL 5 1984"));
map.put("Oxley", df.parse("APRIL 6 1983"));
map.put("Jennings", df.parse("JUNE 7 1981"));
map.put("Fairley", df.parse("JUNE 8 1989"));
return map;
}
public static void removeAllSummerPeople(HashMap<String, Date> map) {
for (HashMap.Entry<String, Date> pair : map.entrySet()){
Date birthdate = pair.getValue();
String name = pair.getKey();
if (birthdate.getMonth() == 6 || birthdate.getMonth() == 7 ||birthdate.getMonth() == 8 ){
map.remove(pair.getKey());
map.remove(pair.getValue());
}
}
}
public static void main(String[] args) {
}
}