1. Home
  2. Computer Science MCQs
  3. JAVA
  4. Which Java collection does not allow duplicate elements?

Added 2 Nov 2026

Which Java collection does not allow duplicate elements?

  1. Vector
  2. ArrayList
  3. HashSet Correct answer
  4. LinkedList

Correct answer

C. HashSet

22 views

MCQSEXAM

Explanation

HashSet implements the Set interface, which rejects duplicates using equals() and hashCode(). Lists such as ArrayList, LinkedList and Vector allow duplicates.

Reference

Asked in: NTS, PPSC, OCA Java

Preparing for an exam?

Doubts & discussion

Not sure why the answer is C? Ask here and get an explanation.

Ask a doubt about this MCQ

Shown after review. No links please.

More JAVA MCQs

Practise all JAVA MCQs

Similar MCQs