Question 20
Back to Exercise
What happens if you remove an element from map.values()?
- A Nothing – it is a copy
- B The corresponding entry is removed from the map, because values() is a live view Correct
- C An exception is always thrown
- D Only the value becomes null
Correct Answer: Option B
keySet(), values() and entrySet() are views backed by the map.
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!