Помогите, пожалуйста, разобраться.
Вроде я все правильно сделал, но не проходит валидация по последнему пункту.
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 2012"));
map.put("Сталлон", dateFormat.parse("MAY 1 2012"));
map.put("Сталло", dateFormat.parse("JUNE 1 2012"));
map.put("Сталл", dateFormat.parse("MAY 1 2012"));
map.put("Стал", dateFormat.parse("MAY 1 2012"));
map.put("Ста", dateFormat.parse("MAY 1 2012"));
map.put("Ст", dateFormat.parse("JULY 1 2012"));
map.put("C", dateFormat.parse("MAY 1 2012"));
map.put("Сергей", dateFormat.parse("MAY 1 2012"));
map.put("Сергей2", dateFormat.parse("MAY 1 2012"));
//напишите тут ваш код
return map;
}
public static void removeAllSummerPeople(Map<String, Date> map) {
//напишите тут ваш код
Date iun = new Date(); //Создал лбъект 1 июня
iun.setHours(0);
iun.setMinutes(0);
iun.setSeconds(0);
iun.setDate(1);
iun.setMonth(5);
iun.setYear(2012);
Date avgust = new Date(); //Создал лбъект 31 августа
avgust.setHours(23);
avgust.setMinutes(59);
avgust.setSeconds(59);
avgust.setDate(1);
avgust.setMonth(7);
avgust.setYear(2012);
Map<String, Date> copy = new HashMap<>(map);
for(Map.Entry<String, Date> pair: copy.entrySet()){
if(iun.before(pair.getValue()) && avgust.after(pair.getValue())) { //если дата между 1 июня и 31 августа, то удаляем
map.remove(pair.getKey());}
}
}
public static void main(String[] args) {
}
}