- uses hashtable to store the elements.It extends AbstractSet class and implements Set interface.
- contains unique elements only.
Difference between List and Set:
List can contain duplicate elements whereas Set contains unique elements only.
Hierarchy of HashSet class:
Example of HashSet class:
Output:Ajay Vijay Ravi
No comments:
Post a Comment