Modifier and Type Method and Description
boolean [**add**](<https://docs.oracle.com/javase/8/docs/api/java/util/HashSet.html#add-E->)([**E**](<https://docs.oracle.com/javase/8/docs/api/java/util/HashSet.html>) e)Adds the specified element to this set if it is not already present.
void [**clear**](<https://docs.oracle.com/javase/8/docs/api/java/util/HashSet.html#clear-->)()Removes all of the elements from this set.
Object [**clone**](<https://docs.oracle.com/javase/8/docs/api/java/util/HashSet.html#clone-->)()Returns a shallow copy of this HashSet instance: the elements themselves are not cloned.
boolean [**contains**](<https://docs.oracle.com/javase/8/docs/api/java/util/HashSet.html#contains-java.lang.Object->)([**Object**](<https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html>) o)Returns true if this set contains the specified element.
boolean [**isEmpty**](<https://docs.oracle.com/javase/8/docs/api/java/util/HashSet.html#isEmpty-->)()Returns true if this set contains no elements.
[**Iterator**](<https://docs.oracle.com/javase/8/docs/api/java/util/Iterator.html>)<[**E**](<https://docs.oracle.com/javase/8/docs/api/java/util/HashSet.html>)> [**iterator**](<https://docs.oracle.com/javase/8/docs/api/java/util/HashSet.html#iterator-->)()Returns an iterator over the elements in this set.
boolean [**remove**](<https://docs.oracle.com/javase/8/docs/api/java/util/HashSet.html#remove-java.lang.Object->)([**Object**](<https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html>) o)Removes the specified element from this set if it is present.
int [**size**](<https://docs.oracle.com/javase/8/docs/api/java/util/HashSet.html#size-->)()Returns the number of elements in this set (its cardinality).
[**Spliterator**](<https://docs.oracle.com/javase/8/docs/api/java/util/Spliterator.html>)<[**E**](<https://docs.oracle.com/javase/8/docs/api/java/util/HashSet.html>)> [**spliterator**](<https://docs.oracle.com/javase/8/docs/api/java/util/HashSet.html#spliterator-->)()Creates a late-binding and fail-fast Spliterator over the elements in this set.