Question 18
Back to Exercise
Which is true of Map.of("a", 1, "b", 2)?
- A It can be modified
- B It is immutable, rejects null keys/values and duplicate keys, and its iteration order is unspecified Correct
- C It keeps insertion order
- D It is a TreeMap
Correct Answer: Option B
Use new LinkedHashMap<>(…) if you need order and mutability.
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!