HashSet in Java | Java Collections | Collection Framework | Java Tutorial For Beginners

preview_player
Показать описание
Please use the following link to install the Katalon Studio:

HashSet:

HashSet is a class which implements Set interface.
The underlying data structure for HashSet is Hashtable.
Duplicate elements are NOT allowed.
If try to add duplicate elements, will not get any compile time or runtime errors.
add() method simply returns false.
Insertion order is NOT preserved.
Elements will be inserted on the basis of hash values.
Heterogeneous objects are allowed.
null insertion is possible.
HashSet is best suitable for Search operation as elements stored on the basis of hash values.

Рекомендации по теме