Skip to content
Sharp

Collections · interview question

For storing a list of unique user IDs where insertion order must be preserved, which collection is most appropriate?

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

Correct answer

A. LinkedHashSet

Why

LinkedHashSet maintains insertion order while ensuring that all elements are unique, thus fitting both criteria of the problem.

Test yourself on Collections

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

Start free test
All Collections questions →