Not having output makes it hard to tell if I'm getting close.
package com.codegym.task.task08.task0816;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
/*
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("Stallone1", df.parse("JUNE 1 1980"));
map.put("Stallone2", df.parse("JULY 1 1980"));
map.put("Stallone3", df.parse("AUGUST 1 1980"));
map.put("Stallone4", df.parse("DECEMBER 1 1980"));
map.put("Stallone5", df.parse("JUNE 1 1980"));
map.put("Stallone6", df.parse("MAY 1 1980"));
map.put("Stallone7", df.parse("JANUARY 1 1980"));
map.put("Stallone8", df.parse("JULY 1 1980"));
map.put("Stallone9", df.parse("OCTOBER 1 1980"));
map.put("Stallone10", df.parse("NOVEMBER 1 1980"));
return map;
}
public static void removeAllSummerPeople(HashMap<String, Date> map) {
Calendar cal = Calendar.getInstance();
for(Map.Entry<String, Date> ptr : map.entrySet() ) {
cal.setTime(ptr.getValue());
Integer month = cal.get(Calendar.MONTH);
if(month.equals(5) || month.equals(6) || month.equals(7)) {
map.remove(ptr.getKey());
}
}
}
public static void main(String[] args) {
}
}