Skip to content
Sharp

Collections · interview question

The hottest operation in the code is have we already processed this orderId?. Which collection usually follows from that workload?

Multiple choiceMediumchapter-4-curatedpremiumcollectionschoosing-the-right-collection
Choose one answer
Answer and explanation

Correct answer

A. A Set<String> for membership checks

Why

If membership testing and uniqueness dominate, a set is often the clearest fit. Strong collection reasoning follows the workload first and lets the structure choice follow from that.

Test yourself on Collections

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

Start free test
All Collections questions →