Skip to content
Sharp

Collections · interview question

Which of the following collections provides the fastest iteration when the order of elements is not important?

Multiple choiceMediumchapter-4-curatedpremiumcollectionsiteration-and-traversal
Choose one answer
Answer and explanation

Correct answer

B. HashSet

Why

HashSet offers the fastest iteration among the options when element order is not important, due to its hash table implementation.

Test yourself on Collections

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

Start free test
All Collections questions →