I do not understand the following: 1) I convert the date into a String and check if it contains a certain month if so I remove the entry. I do not get an error but the code doesn't remove any 2) I tried to use an iterator but somehow I can't get date.getMonth() to work. I do not understand why? 3) The solution on CodeGym is incomprehensible to me. Why use a copy of the original map? What does that do? And secondly why does getMonth() works there and not in my code?? My understanding is that the map has key: value pairs. In this case key is a name with String as datatype. The values are the birthdays with Date as datatype. So if I iterate over this map I'm looking for the values which contain certain months. I also understand that you can't iterate and remove entries at the same time unless you specifically create an iterator. So where do I go wrong with my code. What is wrong in my thinking?
Almost a year later and I still do not understand how this works
getMonth()didn't work as it was crossed out and I didn't know that you could still use it but it is deprecated... 3) The codegym solution is rather difficult to read for me and they use a copy to combine a foreach loop. They use keySet() and assign the value of a key to a Date date and create an int month to check the months. Happy to write that I now solved it with a single line of code!!!💪