чего ему не нравиться?
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("q", dateFormat.parse("MAY 1 2012"));
map.put("w", dateFormat.parse("JUNE 1 2012"));
map.put("o", dateFormat.parse("MAY 1 2012"));
map.put("i", dateFormat.parse("MAY 1 2012"));
map.put("u", dateFormat.parse("JUNE 1 2012"));
map.put("y", dateFormat.parse("MAY 1 2012"));
map.put("t", dateFormat.parse("MAY 1 2012"));
map.put("r", dateFormat.parse("JUNE 1 2012"));
map.put("e", dateFormat.parse("MAY 1 2012"));
return map; }
public static void removeAllSummerPeople(Map<String, Date> map) {
Iterator<Map.Entry<String, Date>> itr = map.entrySet().iterator();
while(itr.hasNext()){ // как понять когда итератор а когда имя?
Date date = itr.getValue();
int d = date.getMonth();
if(d == 5 || d == 6 || d == 7){
itr.remove(); // как понять когда итератор а когда имя?
}
}}
public static void main(String[] args) { }}
или так тож не выходит
Iterator<Map.Entry<String,Date>> iterator = map.entrySet().iterator();
while(iterator.hasNext()) // как понять когда итератор а когда имя?
{
Map.Entry<String,Date> pair = iterator.next();
Date value = pair.getValue();
int rad = value.getMonth();
if(rad == 5 || rad == 6 || rad == 7)
iterator.remove(); // как понять когда итератор а когда имя?
}