A Set is a Collection that cannot contain duplicate elements.
Set models the mathematical set abstraction.
The Set interface extends Collection and contains no methods other than those inherited from Collection . It adds the restriction that duplicate elements are prohibited. Set also adds a stronger contract on the behavior of the equals and hashCode operations, allowing Set objects with different implementation types to be compared meaningfully. Two Set objects are equal if they contain the same elements. The JDK contains two general-purpose Set implementations.