ПРошу помочь с задачей, что идёт не так.
И как запустить debuger, чтобы посмотреть, что и как в какой последовательности делается.
package com.javarush.task.task08.task0816;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.Month;
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("June 1 2012"));
map.put("Смирновач", dateFormat.parse("July 1 2012"));
map.put("Смирнова", dateFormat.parse("August 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("November 1 2012"));
map.put("Сми", dateFormat.parse("December 1 2012"));
map.put("См", dateFormat.parse("October 1 2012"));
return map;
}
public static void removeAllSummerPeople(Map<String, Date> map) {
//напишите тут ваш код
Month month1 = Month.JULY ;
Month month2 = Month.JUNE;
Month month3 = Month.AUGUST;
Iterator <Map.Entry<String, Date>> iterator = map.entrySet().iterator();
while (iterator.hasNext()){
Map.Entry<String, Date> x = iterator.next();
String name = x.getKey();
Date data = x.getValue();
if(data.equals(month1) || data.equals(month2) || data.equals(month3)){
iterator.remove();
}
}
}
public static void main(String[] args) {
}
}