Is this the way to get the answer? if it is, can someone explian me what should I need to edit here ? Or it is just wrong. Thanks
package com.codegym.task.task08.task0816;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Locale;
import java. util. Iterator;
/*
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("yi", df.parse("JUNE 2 1990"));
map.put("Tan", df.parse("AUGUST 1 1980"));
map.put("Yu", df.parse("JULY 2 1970"));
map.put("Zhou", df.parse("JUNE 3 1960"));
map.put("CC", df.parse("NOVERMVER 3 1890"));
map.put("GG", df.parse("October 10 1962"));
map.put("SD", df.parse("Feb 19 1940"));
map.put("hi", df.parse("March 17 1993"));
map.put("JIang", df.parse("April 15 1994"));
return map;
//write your code here
}
public static void removeAllSummerPeople(HashMap<String, Date> map) {
Iterator<HashMap.Entry<String,Date>> it = map.entrySet().iterator();
while (it.hasNext()){
HashMap.Entry<String,Date> entry = it.next();
String value = entry.getValue();
if (value.contains("JUNE") || value.contains("JULY") || value.contains("AUGUST")){
it.remove();
}
}
//write your code here
}
public static void main(String[] args) {
}
}