public static void removeAllSummerPeople(Map<String, Date> map) { Iterator<Map.Entry<String, Date>> iterator = map.entrySet().iterator(); while (iterator.hasNext()) { Map.Entry<String, Date> pair = iterator.next(); String key = pair.getKey(); Date date = pair.getValue(); if (date.getMonth() > 5 && date.getMonth() < 9){ iterator.remove(); } } }