When i run this code on InteliJ is working( i print only 2 pairs) but I can t pass. Any hint? Tk you!
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("Stallon", df.parse("JUNE 19 1980"));
map.put("Stallo", df.parse("JUNE 1 1980"));
map.put("Stall", df.parse("JUNE 1 1980"));
map.put("Stal", df.parse("JUNE 1 1980"));
map.put("Sta", df.parse("MAY 1 1980"));
map.put("St", df.parse("JUNE 1 1980"));
map.put("S", df.parse("JUNE 1 1980"));
map.put("one", df.parse("APRIL 1 1980"));
map.put("llone", df.parse("JUNE 1 1980"));
//write your code here
return map;
}
public static void removeAllSummerPeople(HashMap<String, Date> map) throws ParseException {
//write your code here
DateFormat date = new SimpleDateFormat("MMMM d yyyy", Locale.ENGLISH);
Iterator<Map.Entry<String, Date>> iterator = map.entrySet().iterator();
while(iterator.hasNext()){
Map.Entry<String, Date> pair = iterator.next();
String key = pair.getKey();
Date x = pair.getValue();
if(x.after(date.parse("MAY 31 1980")) && x.before(date.parse("SEPTEMBER 1 1980")))
iterator.remove();
}
}
public static void main(String[] args) {
}
}
hzbanagamahsjha sbs zbs avz acNagzxsu