Type Parameters:
E - the type of elements maintained by this set
All Superinterfaces:
Collection<E>, Iterable<E>
All Known Subinterfaces:
EventSet, NavigableSet<E>, SequencedSet<E>, SortedSet<E>
All Known Implementing Classes:
AbstractSet, ConcurrentHashMap.KeySetView, ConcurrentSkipListSet, CopyOnWriteArraySet, EnumSet, HashSet, JobStateReasons, LinkedHashSet, TreeSet

  • Method Summary

    boolean

    add(E e)

    Adds the specified element to this set if it is not already present (optional operation).

    boolean

    Adds all of the elements in the specified collection to this set if they're not already present (optional operation).

    void

    clear()

    Removes all of the elements from this set (optional operation).

    boolean

    Returns true if this set contains the specified element.

    boolean

    Returns true if this set contains all of the elements of the specified collection.

    static <E> Set<E>

    Returns an unmodifiable Set containing the elements of the given Collection.

    boolean

    Compares the specified object with this set for equality.

    int

    hashCode()

    Returns the hash code value for this set.

    boolean

    isEmpty()

    Returns true if this set contains no elements.

    iterator()

    Returns an iterator over the elements in this set.

    static <E> Set<E>

    of()

    Returns an unmodifiable set containing zero elements.

    static <E> Set<E>

    of(E e1)

    Returns an unmodifiable set containing one element.

    static <E> Set<E>

    of(E... elements)

    Returns an unmodifiable set containing an arbitrary number of elements.

    static <E> Set<E>

    of(E e1, E e2)

    Returns an unmodifiable set containing two elements.

    static <E> Set<E>

    of(E e1, E e2, E e3)

    Returns an unmodifiable set containing three elements.

    static <E> Set<E>

    of(E e1, E e2, E e3, E e4)

    Returns an unmodifiable set containing four elements.

    static <E> Set<E>

    of(E e1, E e2, E e3, E e4, E e5)

    Returns an unmodifiable set containing five elements.

    static <E> Set<E>

    of(E e1, E e2, E e3, E e4, E e5, E e6)

    Returns an unmodifiable set containing six elements.

    static <E> Set<E>

    of(E e1, E e2, E e3, E e4, E e5, E e6, E e7)

    Returns an unmodifiable set containing seven elements.

    static <E> Set<E>

    of(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8)

    Returns an unmodifiable set containing eight elements.

    static <E> Set<E>

    of(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9)

    Returns an unmodifiable set containing nine elements.

    static <E> Set<E>

    of(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9, E e10)

    Returns an unmodifiable set containing ten elements.

    boolean

    Removes the specified element from this set if it is present (optional operation).

    boolean

    Removes from this set all of its elements that are contained in the specified collection (optional operation).

    boolean

    Retains only the elements in this set that are contained in the specified collection (optional operation).

    int

    size()

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

    Creates a Spliterator over the elements in this set.

    toArray()

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

    <T> T[]

    toArray(T[] a)

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

    Methods declared in interface Collection

    parallelStream, removeIf, stream, toArray

    Returns a possibly parallel Stream with this collection as its source.

    default boolean

    Removes all of the elements of this collection that satisfy the given predicate (optional operation).

    Returns a sequential Stream with this collection as its source.

    default <T> T[]

    Returns an array containing all of the elements in this collection, using the provided generator function to allocate the returned array.

    Methods declared in interface Iterable

    forEach

    default void

    Performs the given action for each element of the Iterable until all elements have been processed or the action throws an exception.

  • Method Details

    • size

    • isEmpty

    • contains

    • iterator

    • toArray

    • toArray

    • add

    • remove

    • containsAll

    • addAll

    • retainAll

    • removeAll

    • clear

    • equals

    • hashCode

    • spliterator

    • of

    • of

    • of

    • of

    • of

    • of

    • of

    • of

    • of

    • of

    • of

    • of

    • copyOf