Engineering Full Stack Apps with Java and JavaScript
HashSet Class implements the Set interface, backed by a HashMap instance.
Makes no order guarantees.
Permits the null element.
Offers constant time performance for the basic operations like add, remove, contains and size,
assuming the hash function disperses the elements properly among the buckets.
Default initial capacity of HashSet is 16 and default load factor is 0.75.
In general, you should not set the initial capacity too high (or the load factor too low).
Iterating over this set requires time proportional to the sum of the HashSet instance's size plus the "capacity" of the backing HashMap instance.
Is not synchronized.
Could synchronize on some object that naturally encapsulates the set, or "wrapped" using the Collections.synchronizedSet method.
This is best done at creation time.
The iterators returned by this class's iterator method are fail-fast,
but the fail-fast behavior cannot be guaranteed.
spliterator()
Creates a late-binding and fail-fast Spliterator over the elements in this set.
Introduced in Java 1.8
Other methods include add(E e), clear(), clone(), contains(Object o), isEmpty(), iterator(), remove(Object o) and size().