Skip to content
Sharp

Core Java · interview question

Which Java collection is best suited for maintaining a collection of unique elements that need to be accessed in order of insertion?

Multiple choiceEasychapter-4-curatedpremiumcore-javacode-reading-with-collections
Choose one answer
Answer and explanation

Correct answer

B. LinkedHashSet

Why

LinkedHashSet maintains the order of insertion while ensuring that all elements are unique, making it suitable for this scenario.

Test yourself on Core Java

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

Start free test
All Core Java questions →