Hi guys, please help me, Im trying to use removeIf() to complete that request and I failed without knowing its reason
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;
/*
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("Stallonex", df.parse("JUNE 1 1980"));
//write your code here
map.put("Stallone", df.parse("JUNE 1 1980"));
map.put("Stallon", df.parse("April 1 1980"));
map.put("Stalloe", df.parse("April 1 1980"));
map.put("Stalne", df.parse("AUGUST 1 1980"));
map.put("alone", df.parse("JULY 1 1980"));
map.put("Stlone", df.parse("JULY 1 1980"));
map.put("tallone", df.parse("AUGUST 1 1980"));
map.put("allone", df.parse("JULY 1 1980"));
map.put("lone", df.parse("AUGUST 1 1980"));
return map;
}
public static void removeAllSummerPeople(HashMap<String, Date> map) {
//write your code here
map.values().removeIf(temp ->temp.toString().contains("JUNE")||temp.toString().contains("AUGUST")||temp.toString().contains("JULY"));
}
public static void main(String[] args) {
}
}