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("Stallone", df.parse("JUNE 1 1980")); map.put("Stallon1", df.parse("APRIL 1 1980")); map.put("Stallon2", df.parse("MARCH 1 1980")); map.put("Stallon3", df.parse("MAY 1 1980")); map.put("Stallon4", df.parse("MAY 1 1980")); map.put("Stallon5", df.parse("MAY 1 1980")); map.put("Stallon6", df.parse("JULY 1 1980")); map.put("Stallon7", df.parse("MAY 1 1980")); map.put("Stallon8", df.parse("APRIL 1 1980")); map.put("Stallon9", df.parse("MAY 1 1980")); //write your code here //System.out.println(map); return map; } public static void removeAllSummerPeople(HashMap<String, Date> map) { //write your code here Iterator<Map.Entry<String, Date>> iterator = map.entrySet().iterator(); while(iterator.hasNext()){ Map.Entry<String,Date> element = iterator.next(); int m = element.getValue().getMonth(); String s = element.getKey(); if(m > 4 && m < 7){ iterator.remove(); //map.remove(s); } } } public static void main(String[] args) throws Exception { //createMap(); } }