Multiple choice

You need to store elements in a collection that guarantees that no duplicates are stored. Which one of the following interfaces provide that capability?

  1. Java.util.Map

  2. Java.util.List

  3. Java.util.Collection

  4. None of the above

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

Option A is correct. A Map cannot contain duplicate keys. Option B is wrong. Lists typically allow duplicate elements. Option C is wrong. Collection allows duplicate elements.