Skip to content
Sharp

Collections · interview question

Which Java collection should you use if you need to store elements with fast random access and allow duplicates?

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

Correct answer

C. ArrayList

Why

ArrayList is the best choice for fast random access and allows duplicates. HashSet, TreeSet, and LinkedHashSet do not allow duplicates, and TreeSet is sorted, which is not a requirement here.

Test yourself on Collections

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

Start free test
All Collections questions →