Time Out
package com.javarush.task.task08.task0816;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
/*
Добрая Зинаида и летние каникулы
*/
public class Solution {
public static Map<String, Date> createMap() throws ParseException {
DateFormat dateFormat = new SimpleDateFormat("MMMMM d yyyy", Locale.ENGLISH);
Map<String, Date> map = new HashMap<>();
map.put("Сталлоне", dateFormat.parse("MAY 1 2015"));
map.put("Бессон", dateFormat.parse("APRIL 25 2012"));
map.put("Ван Дам", dateFormat.parse("JUNE 16 2011"));
map.put("Уиллис", dateFormat.parse("JULY 7 2013"));
map.put("Ривз", dateFormat.parse("SEPTEMBER 1 2012"));
map.put("Аль Пачино", dateFormat.parse("JUNE 10 2012"));
map.put("Де Ниро", dateFormat.parse("JANUARY 22 2012"));
map.put("Бэйл", dateFormat.parse("FEBRUARY 14 2012"));
map.put("Шварцнеггер", dateFormat.parse("MARCH 8 2012"));
map.put("Кейдж", dateFormat.parse("OCTOBER 23 2012"));
return map;
}
public static void removeAllSummerPeople(Map<String, Date> map) {
//напишите тут ваш код
Iterator<Map.Entry<String, Date>> it = map.entrySet().iterator();
Map.Entry<String, Date> pair = it.next();
while (it.hasNext()) {
int month = pair.getValue().getMonth();
if (month>4 && month<8) {
it.remove();
}
}
}
public static void main(String[] args) {
}
}