Practice mode Java

Which core Java collection interface models a collection with no duplicate elements?

Correct answer B. Set

Explanation

The Set interface models the mathematical idea of a set, so adding an element equal to one already present leaves the collection unchanged and add returns false. List and Deque allow duplicates and keep positional or end-based access, and a Queue is designed for holding elements before processing. Equality is decided by equals.

Report a problem

Answer checked How we write and check questions

Tip: press A, B, C or D to answer, and N for the next question.

Advertisement

Have a question about this answer?

Your email address will not be published. Required fields are marked *

Links and website addresses are not allowed in comments.