Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Protected Ctors](https://developer.android.com/reference/java/util/AbstractSet#proctors) \| [Methods](https://developer.android.com/reference/java/util/AbstractSet#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/java/util/AbstractSet#inhmethods)

# AbstractSet


`
public


abstract
class
AbstractSet
`


`


`

`

extends https://developer.android.com/reference/java/util/AbstractCollection<E>


`

`


implements

https://developer.android.com/reference/java/util/Set<E>


`

|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) |||
| ↳ | [java.util.AbstractCollection](https://developer.android.com/reference/java/util/AbstractCollection)\<E\> ||
|   | ↳ | java.util.AbstractSet\<E\> |

|---|
| Known direct subclasses [ConcurrentSkipListSet](https://developer.android.com/reference/java/util/concurrent/ConcurrentSkipListSet)\<E\>, [CopyOnWriteArraySet](https://developer.android.com/reference/java/util/concurrent/CopyOnWriteArraySet)\<E\>, [EnumSet](https://developer.android.com/reference/java/util/EnumSet)\<E extends [Enum](https://developer.android.com/reference/java/lang/Enum)\<E\>\>, [HashSet](https://developer.android.com/reference/java/util/HashSet)\<E\>, [TreeSet](https://developer.android.com/reference/java/util/TreeSet)\<E\> |---|---| | [ConcurrentSkipListSet](https://developer.android.com/reference/java/util/concurrent/ConcurrentSkipListSet)\<E\> | A scalable concurrent `https://developer.android.com/reference/java/util/NavigableSet` implementation based on a `https://developer.android.com/reference/java/util/concurrent/ConcurrentSkipListMap`. | | [CopyOnWriteArraySet](https://developer.android.com/reference/java/util/concurrent/CopyOnWriteArraySet)\<E\> | A `https://developer.android.com/reference/java/util/Set` that uses an internal `https://developer.android.com/reference/java/util/concurrent/CopyOnWriteArrayList` for all of its operations. | | [EnumSet](https://developer.android.com/reference/java/util/EnumSet)\<E extends [Enum](https://developer.android.com/reference/java/lang/Enum)\<E\>\> | A specialized `https://developer.android.com/reference/java/util/Set` implementation for use with enum types. | | [HashSet](https://developer.android.com/reference/java/util/HashSet)\<E\> | This class implements the `Set` interface, backed by a hash table (actually a `HashMap` instance). | | [TreeSet](https://developer.android.com/reference/java/util/TreeSet)\<E\> | A `https://developer.android.com/reference/java/util/NavigableSet` implementation based on a `https://developer.android.com/reference/java/util/TreeMap`. | |

|---|
| Known indirect subclasses [LinkedHashSet](https://developer.android.com/reference/java/util/LinkedHashSet)\<E\> |---|---| | [LinkedHashSet](https://developer.android.com/reference/java/util/LinkedHashSet)\<E\> | Hash table and linked list implementation of the `Set` interface, with well-defined encounter order. | |

<br />

*** ** * ** ***

This class provides a skeletal implementation of the `Set`
interface to minimize the effort required to implement this
interface.


The process of implementing a set by extending this class is identical
to that of implementing a Collection by extending AbstractCollection,
except that all of the methods and constructors in subclasses of this
class must obey the additional constraints imposed by the `Set`
interface (for instance, the add method must not permit addition of
multiple instances of an object to a set).


Note that this class does not override any of the implementations from
the `AbstractCollection` class. It merely adds implementations
for `equals` and `hashCode`.


This class is a member of the
[Java Collections Framework](https://reference/java/util/package-summary.html#CollectionsFramework).
**See also:**

- `https://developer.android.com/reference/java/util/Collection`
- `https://developer.android.com/reference/java/util/AbstractCollection`
- `https://developer.android.com/reference/java/util/Set`

## Summary

| ### Protected constructors ||
|---|---|
| ` https://developer.android.com/reference/java/util/AbstractSet#AbstractSet()() ` Sole constructor. |

| ### Public methods ||
|---|---|
| ` boolean` | ` https://developer.android.com/reference/java/util/AbstractSet#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object o) ` Compares the specified object with this set for equality. |
| ` int` | ` https://developer.android.com/reference/java/util/AbstractSet#hashCode()() ` Returns the hash code value for this set. |
| ` boolean` | ` https://developer.android.com/reference/java/util/AbstractSet#removeAll(java.util.Collection<?>)(https://developer.android.com/reference/java/util/Collection<?> c) ` Removes from this set all of its elements that are contained in the specified collection (optional operation). |

| ### Inherited methods |
|---|---|
| From class ` https://developer.android.com/reference/java/util/AbstractCollection ` |---|---| | ` boolean` | ` https://developer.android.com/reference/java/util/AbstractCollection#add(E)(E e) ` Ensures that this collection contains the specified element (optional operation). | | ` boolean` | ` https://developer.android.com/reference/java/util/AbstractCollection#addAll(java.util.Collection<?%20extends%20E>)(https://developer.android.com/reference/java/util/Collection<? extends E> c) ` Adds all of the elements in the specified collection to this collection (optional operation). | | ` void` | ` https://developer.android.com/reference/java/util/AbstractCollection#clear()() ` Removes all of the elements from this collection (optional operation). | | ` boolean` | ` https://developer.android.com/reference/java/util/AbstractCollection#contains(java.lang.Object)(https://developer.android.com/reference/java/lang/Object o) ` Returns `true` if this collection contains the specified element. | | ` boolean` | ` https://developer.android.com/reference/java/util/AbstractCollection#containsAll(java.util.Collection<?>)(https://developer.android.com/reference/java/util/Collection<?> c) ` Returns `true` if this collection contains all of the elements in the specified collection. | | ` boolean` | ` https://developer.android.com/reference/java/util/AbstractCollection#isEmpty()() ` Returns `true` if this collection contains no elements. | | ` abstract https://developer.android.com/reference/java/util/Iterator<E>` | ` https://developer.android.com/reference/java/util/AbstractCollection#iterator()() ` Returns an iterator over the elements contained in this collection. | | ` boolean` | ` https://developer.android.com/reference/java/util/AbstractCollection#remove(java.lang.Object)(https://developer.android.com/reference/java/lang/Object o) ` Removes a single instance of the specified element from this collection, if it is present (optional operation). | | ` boolean` | ` https://developer.android.com/reference/java/util/AbstractCollection#removeAll(java.util.Collection<?>)(https://developer.android.com/reference/java/util/Collection<?> c) ` Removes all of this collection's elements that are also contained in the specified collection (optional operation). | | ` boolean` | ` https://developer.android.com/reference/java/util/AbstractCollection#retainAll(java.util.Collection<?>)(https://developer.android.com/reference/java/util/Collection<?> c) ` Retains only the elements in this collection that are contained in the specified collection (optional operation). | | ` abstract int` | ` https://developer.android.com/reference/java/util/AbstractCollection#size()() ` Returns the number of elements in this collection. | | ` <T> T[]` | ` https://developer.android.com/reference/java/util/AbstractCollection#toArray(T[])(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. | | ` https://developer.android.com/reference/java/lang/Object` | ` https://developer.android.com/reference/java/util/AbstractCollection#toArray()() ` Returns an array containing all of the elements in this collection. | | ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/java/util/AbstractCollection#toString()() ` Returns a string representation of this collection. | ||
| From class ` https://developer.android.com/reference/java/lang/Object ` |---|---| | ` https://developer.android.com/reference/java/lang/Object` | ` https://developer.android.com/reference/java/lang/Object#clone()() ` Creates and returns a copy of this object. | | ` boolean` | ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) ` Indicates whether some other object is "equal to" this one. | | ` void` | ` https://developer.android.com/reference/java/lang/Object#finalize()() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. | | ` final https://developer.android.com/reference/java/lang/Class<?>` | ` https://developer.android.com/reference/java/lang/Object#getClass()() ` Returns the runtime class of this `Object`. | | ` int` | ` https://developer.android.com/reference/java/lang/Object#hashCode()() ` Returns a hash code value for the object. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notify()() ` Wakes up a single thread that is waiting on this object's monitor. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notifyAll()() ` Wakes up all threads that are waiting on this object's monitor. | | ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/java/lang/Object#toString()() ` Returns a string representation of the object. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait()() ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*. | ||
| From interface ` https://developer.android.com/reference/java/util/Collection ` |---|---| | ` abstract boolean` | ` https://developer.android.com/reference/java/util/Collection#add(E)(E e) ` Ensures that this collection contains the specified element (optional operation). | | ` abstract boolean` | ` https://developer.android.com/reference/java/util/Collection#addAll(java.util.Collection<?%20extends%20E>)(https://developer.android.com/reference/java/util/Collection<? extends E> c) ` Adds all of the elements in the specified collection to this collection (optional operation). | | ` abstract void` | ` https://developer.android.com/reference/java/util/Collection#clear()() ` Removes all of the elements from this collection (optional operation). | | ` abstract boolean` | ` https://developer.android.com/reference/java/util/Collection#contains(java.lang.Object)(https://developer.android.com/reference/java/lang/Object o) ` Returns `true` if this collection contains the specified element. | | ` abstract boolean` | ` https://developer.android.com/reference/java/util/Collection#containsAll(java.util.Collection<?>)(https://developer.android.com/reference/java/util/Collection<?> c) ` Returns `true` if this collection contains all of the elements in the specified collection. | | ` abstract boolean` | ` https://developer.android.com/reference/java/util/Collection#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object o) ` Compares the specified object with this collection for equality. | | ` abstract int` | ` https://developer.android.com/reference/java/util/Collection#hashCode()() ` Returns the hash code value for this collection. | | ` abstract boolean` | ` https://developer.android.com/reference/java/util/Collection#isEmpty()() ` Returns `true` if this collection contains no elements. | | ` abstract https://developer.android.com/reference/java/util/Iterator<E>` | ` https://developer.android.com/reference/java/util/Collection#iterator()() ` Returns an iterator over the elements in this collection. | | ` default https://developer.android.com/reference/java/util/stream/Stream<E>` | ` https://developer.android.com/reference/java/util/Collection#parallelStream()() ` Returns a possibly parallel `Stream` with this collection as its source. | | ` abstract boolean` | ` https://developer.android.com/reference/java/util/Collection#remove(java.lang.Object)(https://developer.android.com/reference/java/lang/Object o) ` Removes a single instance of the specified element from this collection, if it is present (optional operation). | | ` abstract boolean` | ` https://developer.android.com/reference/java/util/Collection#removeAll(java.util.Collection<?>)(https://developer.android.com/reference/java/util/Collection<?> c) ` Removes all of this collection's elements that are also contained in the specified collection (optional operation). | | ` default boolean` | ` https://developer.android.com/reference/java/util/Collection#removeIf(java.util.function.Predicate<?%20super%20E>)(https://developer.android.com/reference/java/util/function/Predicate<? super E> filter) ` Removes all of the elements of this collection that satisfy the given predicate (optional operation). | | ` abstract boolean` | ` https://developer.android.com/reference/java/util/Collection#retainAll(java.util.Collection<?>)(https://developer.android.com/reference/java/util/Collection<?> c) ` Retains only the elements in this collection that are contained in the specified collection (optional operation). | | ` abstract int` | ` https://developer.android.com/reference/java/util/Collection#size()() ` Returns the number of elements in this collection. | | ` default https://developer.android.com/reference/java/util/Spliterator<E>` | ` https://developer.android.com/reference/java/util/Collection#spliterator()() ` Creates a `https://developer.android.com/reference/java/util/Spliterator` over the elements in this collection. | | ` default https://developer.android.com/reference/java/util/stream/Stream<E>` | ` https://developer.android.com/reference/java/util/Collection#stream()() ` Returns a sequential `Stream` with this collection as its source. | | ` abstract <T> T[]` | ` https://developer.android.com/reference/java/util/Collection#toArray(T[])(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. | | ` abstract https://developer.android.com/reference/java/lang/Object` | ` https://developer.android.com/reference/java/util/Collection#toArray()() ` Returns an array containing all of the elements in this collection. | | ` default <T> T[]` | ` https://developer.android.com/reference/java/util/Collection#toArray(java.util.function.IntFunction<T[]>)(https://developer.android.com/reference/java/util/function/IntFunction<T[]> generator) ` Returns an array containing all of the elements in this collection, using the provided `generator` function to allocate the returned array. | ||
| From interface ` https://developer.android.com/reference/java/util/Set ` |---|---| | ` abstract boolean` | ` https://developer.android.com/reference/java/util/Set#add(E)(E e) ` Adds the specified element to this set if it is not already present (optional operation). | | ` abstract boolean` | ` https://developer.android.com/reference/java/util/Set#addAll(java.util.Collection<?%20extends%20E>)(https://developer.android.com/reference/java/util/Collection<? extends E> c) ` Adds all of the elements in the specified collection to this set if they're not already present (optional operation). | | ` abstract void` | ` https://developer.android.com/reference/java/util/Set#clear()() ` Removes all of the elements from this set (optional operation). | | ` abstract boolean` | ` https://developer.android.com/reference/java/util/Set#contains(java.lang.Object)(https://developer.android.com/reference/java/lang/Object o) ` Returns `true` if this set contains the specified element. | | ` abstract boolean` | ` https://developer.android.com/reference/java/util/Set#containsAll(java.util.Collection<?>)(https://developer.android.com/reference/java/util/Collection<?> c) ` Returns `true` if this set contains all of the elements of the specified collection. | | ` static <E> https://developer.android.com/reference/java/util/Set<E>` | ` https://developer.android.com/reference/java/util/Set#copyOf(java.util.Collection<?%20extends%20E>)(https://developer.android.com/reference/java/util/Collection<? extends E> coll) ` Returns an [unmodifiable Set](https://developer.android.com/reference/java/util/AbstractSet#unmodifiable) containing the elements of the given Collection. | | ` abstract boolean` | ` https://developer.android.com/reference/java/util/Set#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object o) ` Compares the specified object with this set for equality. | | ` abstract int` | ` https://developer.android.com/reference/java/util/Set#hashCode()() ` Returns the hash code value for this set. | | ` abstract boolean` | ` https://developer.android.com/reference/java/util/Set#isEmpty()() ` Returns `true` if this set contains no elements. | | ` abstract https://developer.android.com/reference/java/util/Iterator<E>` | ` https://developer.android.com/reference/java/util/Set#iterator()() ` Returns an iterator over the elements in this set. | | ` static <E> https://developer.android.com/reference/java/util/Set<E>` | ` https://developer.android.com/reference/java/util/Set#of(E,%20E,%20E)(E e1, E e2, E e3) ` Returns an unmodifiable set containing three elements. | | ` static <E> https://developer.android.com/reference/java/util/Set<E>` | ` https://developer.android.com/reference/java/util/Set#of(E,%20E,%20E,%20E,%20E,%20E,%20E,%20E,%20E)(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> https://developer.android.com/reference/java/util/Set<E>` | ` https://developer.android.com/reference/java/util/Set#of(E,%20E,%20E,%20E,%20E)(E e1, E e2, E e3, E e4, E e5) ` Returns an unmodifiable set containing five elements. | | ` static <E> https://developer.android.com/reference/java/util/Set<E>` | ` https://developer.android.com/reference/java/util/Set#of(E,%20E,%20E,%20E,%20E,%20E)(E e1, E e2, E e3, E e4, E e5, E e6) ` Returns an unmodifiable set containing six elements. | | ` static <E> https://developer.android.com/reference/java/util/Set<E>` | ` https://developer.android.com/reference/java/util/Set#of(E,%20E,%20E,%20E,%20E,%20E,%20E,%20E)(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> https://developer.android.com/reference/java/util/Set<E>` | ` https://developer.android.com/reference/java/util/Set#of(E[])(E... elements) ` Returns an unmodifiable set containing an arbitrary number of elements. | | ` static <E> https://developer.android.com/reference/java/util/Set<E>` | ` https://developer.android.com/reference/java/util/Set#of()() ` Returns an unmodifiable set containing zero elements. | | ` static <E> https://developer.android.com/reference/java/util/Set<E>` | ` https://developer.android.com/reference/java/util/Set#of(E,%20E,%20E,%20E,%20E,%20E,%20E,%20E,%20E,%20E)(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. | | ` static <E> https://developer.android.com/reference/java/util/Set<E>` | ` https://developer.android.com/reference/java/util/Set#of(E,%20E)(E e1, E e2) ` Returns an unmodifiable set containing two elements. | | ` static <E> https://developer.android.com/reference/java/util/Set<E>` | ` https://developer.android.com/reference/java/util/Set#of(E,%20E,%20E,%20E,%20E,%20E,%20E)(E e1, E e2, E e3, E e4, E e5, E e6, E e7) ` Returns an unmodifiable set containing seven elements. | | ` static <E> https://developer.android.com/reference/java/util/Set<E>` | ` https://developer.android.com/reference/java/util/Set#of(E,%20E,%20E,%20E)(E e1, E e2, E e3, E e4) ` Returns an unmodifiable set containing four elements. | | ` static <E> https://developer.android.com/reference/java/util/Set<E>` | ` https://developer.android.com/reference/java/util/Set#of(E)(E e1) ` Returns an unmodifiable set containing one element. | | ` abstract boolean` | ` https://developer.android.com/reference/java/util/Set#remove(java.lang.Object)(https://developer.android.com/reference/java/lang/Object o) ` Removes the specified element from this set if it is present (optional operation). | | ` abstract boolean` | ` https://developer.android.com/reference/java/util/Set#removeAll(java.util.Collection<?>)(https://developer.android.com/reference/java/util/Collection<?> c) ` Removes from this set all of its elements that are contained in the specified collection (optional operation). | | ` abstract boolean` | ` https://developer.android.com/reference/java/util/Set#retainAll(java.util.Collection<?>)(https://developer.android.com/reference/java/util/Collection<?> c) ` Retains only the elements in this set that are contained in the specified collection (optional operation). | | ` abstract int` | ` https://developer.android.com/reference/java/util/Set#size()() ` Returns the number of elements in this set (its cardinality). | | ` default https://developer.android.com/reference/java/util/Spliterator<E>` | ` https://developer.android.com/reference/java/util/Set#spliterator()() ` Creates a `Spliterator` over the elements in this set. | | ` abstract https://developer.android.com/reference/java/lang/Object` | ` https://developer.android.com/reference/java/util/Set#toArray()() ` Returns an array containing all of the elements in this set. | | ` abstract <T> T[]` | ` https://developer.android.com/reference/java/util/Set#toArray(T[])(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. | ||
| From interface ` https://developer.android.com/reference/java/lang/Iterable ` |---|---| | ` default void` | ` https://developer.android.com/reference/java/lang/Iterable#forEach(java.util.function.Consumer<?%20super%20T>)(https://developer.android.com/reference/java/util/function/Consumer<? super T> action) ` Performs the given action for each element of the `Iterable` until all elements have been processed or the action throws an exception. | | ` abstract https://developer.android.com/reference/java/util/Iterator<E>` | ` https://developer.android.com/reference/java/lang/Iterable#iterator()() ` Returns an iterator over elements of type `T`. | | ` default https://developer.android.com/reference/java/util/Spliterator<E>` | ` https://developer.android.com/reference/java/lang/Iterable#spliterator()() ` Creates a `https://developer.android.com/reference/java/util/Spliterator` over the elements described by this `Iterable`. | ||

## Protected constructors

### AbstractSet

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
protected AbstractSet ()
```

Sole constructor. (For invocation by subclass constructors, typically
implicit.)

<br />

## Public methods

### equals

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean equals (Object o)
```

Compares the specified object with this set for equality. Returns
`true` if the given object is also a set, the two sets have
the same size, and every member of the given set is contained in
this set. This ensures that the `equals` method works
properly across different implementations of the `Set`
interface.


This implementation first checks if the specified object is this
set; if so it returns `true`. Then, it checks if the
specified object is a set whose size is identical to the size of
this set; if not, it returns false. If so, it returns
`containsAll((Collection) o)`.

<br />

| Parameters ||
|---|---|
| `o` | `Object`: object to be compared for equality with this set <br /> |

| Returns ||
|---|---|
| `boolean` | `true` if the specified object is equal to this set <br /> |

### hashCode

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int hashCode ()
```

Returns the hash code value for this set. The hash code of a set is
defined to be the sum of the hash codes of the elements in the set,
where the hash code of a `null` element is defined to be zero.
This ensures that `s1.equals(s2)` implies that
`s1.hashCode()==s2.hashCode()` for any two sets `s1`
and `s2`, as required by the general contract of
`https://developer.android.com/reference/java/lang/Object#hashCode()`.

This implementation iterates over the set, calling the
`hashCode` method on each element in the set, and adding up
the results.

<br />

| Returns ||
|---|---|
| `int` | the hash code value for this set <br /> |

**See also:**

- `https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)`
- `https://developer.android.com/reference/java/util/Set#equals(java.lang.Object)`

### removeAll

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean removeAll (Collection<?> c)
```

Removes from this set all of its elements that are contained in the
specified collection (optional operation). If the specified
collection is also a set, this operation effectively modifies this
set so that its value is the *asymmetric set difference* of
the two sets.

This implementation determines which is the smaller of this set
and the specified collection, by invoking the `size`
method on each. If this set has fewer elements, then the
implementation iterates over this set, checking each element
returned by the iterator in turn to see if it is contained in
the specified collection. If it is so contained, it is removed
from this set with the iterator's `remove` method. If
the specified collection has fewer elements, then the
implementation iterates over the specified collection, removing
from this set each element returned by the iterator, using this
set's `remove` method.

Note that this implementation will throw an
`UnsupportedOperationException` if the iterator returned by the
`iterator` method does not implement the `remove` method.

<br />

| Parameters ||
|---|---|
| `c` | `Collection`: collection containing elements to be removed from this set <br /> |

| Returns ||
|---|---|
| `boolean` | `true` if this set changed as a result of the call <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/ClassCastException` | if the class of an element of this set is incompatible with the specified collection ([optional](https://developer.android.com/reference/java/util/Collection#optional-restrictions)) |
| `https://developer.android.com/reference/java/lang/NullPointerException` | if this set contains a null element and the specified collection does not permit null elements ([optional](https://developer.android.com/reference/java/util/Collection#optional-restrictions)), or if the specified collection is null |
| `https://developer.android.com/reference/java/lang/UnsupportedOperationException` | if the `removeAll` operation is not supported by this set |

**See also:**

- `https://developer.android.com/reference/java/util/AbstractCollection#remove(java.lang.Object)`
- `https://developer.android.com/reference/java/util/AbstractCollection#contains(java.lang.Object)`