digital-garden/notes/Собеседования/Задачи/Задача 4.md
2024-06-13 21:01:37 +03:00

25 lines
573 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
parents:
- "[[Вопросы для собеседование Java]]"
---
```java
import java.util.HashMap;
import java.util.Map;
public class Main {
public static void main(String[] args) {
Map<String, String> map = new HashMap<>();
map.put("a", "a");
for (String key : map.keySet()) {
map.remove(key);
}
}
}
```
%%
В таком случае ничего не произойдет ConcurrentModificationException произойдет только при 2 элементах в Map
%%