Skip to content
Sharp

Collections · interview question

Which collection would you choose to maintain insertion order of product reviews and why?

Multiple choiceMediumchapter-4-curatedpremiumcollectionscollection-performance-basics
Choose one answer
Answer and explanation

Correct answer

B. LinkedHashSet

Why

LinkedHashSet maintains the insertion order of elements while ensuring uniqueness, making it suitable for use cases where the order of additions matters.

Test yourself on Collections

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

Start free test
All Collections questions →