Constructs a new, empty set.
Constructs a new set containing the elements in the specified collection.
Constructs a new, empty set.
Constructs a new, empty set.
Adds the specified element to this set if it is not already present. More formally, adds the specified element {@code e} to this set if this set contains no element {@code e2} such that {@code Objects.equals(e, e2)}. If this set already contains the element, the call leaves the set unchanged and returns {@code false}.
Adds all of the elements in the specified collection to this set if they're not already present (optional operation). If the specified collection is also a set, the {@code addAll} operation effectively modifies this set so that its value is the <i>union</i> of the two sets. The behavior of this operation is undefined if the specified collection is modified while the operation is in progress.
Removes all of the elements from this set. The set will be empty after this call returns.
Returns {@code true} if this set contains the specified element. More formally, returns {@code true} if and only if this set contains an element {@code e} such that {@code Objects.equals(o, e)}.
Returns {@code true} if this set contains no elements.
Removes the specified element from this set if it is present. More formally, removes an element {@code e} such that {@code Objects.equals(o, e)}, if this set contains such an element. Returns {@code true} if this set contained the element (or equivalently, if this set changed as a result of the call). (This set will not contain the element once the call returns.)
Returns the number of elements in this set (its cardinality).
Returns an array containing all of the elements in this set. If this set makes any guarantees as to what order its elements are returned by its iterator, this method must return the elements in the same order.
This class implements the {@code Set} interface, backed by a hash table (actually a {@code HashMap} instance). It makes no guarantees as to the iteration order of the set; in particular, it does not guarantee that the order will remain constant over time. This class permits the {@code null} element.