Skip to content
Sharp

Collections · interview question

In what scenario might using a Map communicate better intent than a List?

Multiple choiceMediumchapter-4-curatedpremiumcollectionsmap-interface-and-hashmap
Choose one answer
Answer and explanation

Correct answer

D. When storing items with unique identifiers

Why

A Map is more suitable when you need to store items with unique identifiers. It allows for efficient retrieval, update, and management of elements based on keys, conveying clear intent for key-value associations.

Test yourself on Collections

A free test with instant, explained results. No account needed.

Start free test
All Collections questions →