Не принимает последний пункт. Настолько не понял тему, что даже не могу предположить, почему. Буду рад подсказке и пояснению, почему мой код не работает.
Также хотелось бы уточнить, имеет ли смысл пока забить на задачи этого блока и вернуться к ним позднее? Или пока эту тему не пойму - дальше нет смысла двигаться? Может, подскажете, где тема хорошо расписана? Увы, по материалам JR осталась каша в голове.
package com.javarush.task.task08.task0816;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.HashMap;
import java.util.Date;
import java.util.Locale;
import java.util.Map;
/*
Добрая Зинаида и летние каникулы
*/
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("Каракай", dateFormat.parse("APRIL 29 1994"));
map.put("Сапильникова", dateFormat.parse("JULY 22 1996"));
map.put("Тындык", dateFormat.parse("JANUARY 17 1995"));
map.put("Муха", dateFormat.parse("FEBRUARY 5 1993"));
map.put("Сиренко", dateFormat.parse("MARCH 12 1995"));
map.put("Иванов", dateFormat.parse("JUNE 22 1999"));
map.put("Петров", dateFormat.parse("AUGUST 3 1992"));
map.put("Сидоров", dateFormat.parse("SEPTEMBER 17 1991"));
map.put("Пеньков", dateFormat.parse("NOVEMBER 22 1990"));
return map;//напишите тут ваш код
}
public static void removeAllSummerPeople(Map<String, Date> map) {
// Map<String, Date> copyMap = new HashMap<>(map);
for (Map.Entry<String, Date> pair : map.entrySet()){
Date value = pair.getValue();
if (value.toString().contains("JUNE")) map.remove(pair.getKey());
else if (value.toString().contains("JULY")) map.remove(pair.getKey());
else if (value.toString().contains("AUGUST")) map.remove(pair.getKey());
}
//напишите тут ваш код
}
public static void main(String[] args) {
}
}
*- {@code dow} is the day of the week ({@code Sun, Mon, Tue, Wed,
* Thu, Fri, Sat}).
*
- {@code mon} is the month ({@code Jan, Feb, Mar, Apr, May, Jun,
* Jul, Aug, Sep, Oct, Nov, Dec}).
*
- {@code dd} is the day of the month ({@code 01} through
* {@code 31}), as two decimal digits.
*
- {@code hh} is the hour of the day ({@code 00} through
* {@code 23}), as two decimal digits.
*
- {@code mm} is the minute within the hour ({@code 00} through
* {@code 59}), as two decimal digits.
*
- {@code ss} is the second within the minute ({@code 00} through
* {@code 61}, as two decimal digits.
*
- {@code zzz} is the time zone (and may reflect daylight saving
* time). Standard time zone abbreviations include those
* recognized by the method {@code parse}. If time zone
* information is not available, then {@code zzz} is empty -
* that is, it consists of no characters at all.
*
- {@code yyyy} is the year, as four decimal digits.
*
* * @return a string representation of this date. * @see java.util.Date#toLocaleString() * @see java.util.Date#toGMTString() */ Но о модификации ему тоже стоит знать, я так посчитал. Про формат ниже написали, тем более.