//Does a Map need to go through a Map loop to delete elements?
//Does the Map need to use Map’s key to delete elements?
//Does a Map need to go through a Map loop to delete elements?
//Does the Map need to use Map’s key to delete elements?
Just use the remove node
If you want to clear a map, use
There’s hardly ever any point in using loops on maps. The whole idea of maps is you don’t need loops.
The for each loop uses indexes to access the elements. This being said you should not modify the array while looping through it. So the deletion in the picture below is wrong?
It’s not an array, it’s a map, so you can remove any element in any order