Type Parameters:
E - the type of elements maintained by this set
All Implemented Interfaces:
Serializable, Cloneable, Iterable<E>, Collection<E>, Set<E>
Direct Known Subclasses:
JobStateReasons, LinkedHashSet

  • Constructor Summary

    Constructors

    HashSet()

    Constructs a new, empty set; the backing HashMap instance has default initial capacity (16) and load factor (0.75).

    HashSet(int initialCapacity)

    Constructs a new, empty set; the backing HashMap instance has the specified initial capacity and default load factor (0.75).

    HashSet(int initialCapacity, float loadFactor)

    Constructs a new, empty set; the backing HashMap instance has the specified initial capacity and the specified load factor.

    Constructs a new set containing the elements in the specified collection.

  • Method Summary

    boolean

    add(E e)

    Adds the specified element to this set if it is not already present.

    void

    clear()

    Removes all of the elements from this set.

    clone()

    Returns a shallow copy of this HashSet instance: the elements themselves are not cloned.

    boolean

    Returns true if this set contains the specified element.

    boolean

    isEmpty()

    Returns true if this set contains no elements.

    iterator()

    Returns an iterator over the elements in this set.

    newHashSet(int numElements)

    Creates a new, empty HashSet suitable for the expected number of elements.

    boolean

    Removes the specified element from this set if it is present.

    int

    size()

    Returns the number of elements in this set (its cardinality).

    toArray()

    Returns an array containing all of the elements in this collection.

    <T> T[]

    toArray(T[] a)

    Returns an array containing all of the elements in this collection; the runtime type of the returned array is that of the specified array.

  • Constructor Details

    • HashSet

    • HashSet

    • HashSet

    • HashSet

  • Method Details

    • iterator

    • size

    • isEmpty

    • contains

    • add

    • remove

    • clear

    • clone

    • spliterator

    • toArray

    • toArray

    • newHashSet