# AbstractSet

public abstract class **AbstractSet** extends [AbstractCollection](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/AbstractCollection.html)\<E\>  
implements [Set](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Set.html)\<E\>

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

|---|---|---|
| Known Indirect Subclasses [LinkedHashSet](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/LinkedHashSet.html)\<E\> |---|---| | [LinkedHashSet](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/LinkedHashSet.html)\<E\> | Hash table and linked list implementation of the Set interface, with predictable iteration order. | |||

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://developers.google.com/j2objc/javadoc/jre/technotes/guides/collections/index.html).

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Collection.html`
- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/AbstractCollection.html`
- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Set.html`

### Protected Constructor Summary

|---|---|
|   | [AbstractSet](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/AbstractSet.html#AbstractSet())() Sole constructor. |

### Public Method Summary

|---|---|
| boolean | [equals](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/AbstractSet.html#equals(java.lang.Object))([Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) o) Compares the specified object with this set for equality. |
| int | [hashCode](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/AbstractSet.html#hashCode())() Returns the hash code value for this set. |
| boolean | [removeAll](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/AbstractSet.html#removeAll(java.util.Collection<?>))([Collection](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Collection.html)\<?\> c) Removes from this set all of its elements that are contained in the specified collection (optional operation). |

### Inherited Method Summary

From class [java.util.AbstractCollection](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/AbstractCollection.html)

|---|---|
| boolean | [add](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/AbstractCollection.html#add(E))(E e) Ensures that this collection contains the specified element (optional operation). This implementation always throws an UnsupportedOperationException. |
| boolean | [addAll](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/AbstractCollection.html#addAll(java.util.Collection<?%20extends%20E>))([Collection](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Collection.html)\<? extends E\> c) Adds all of the elements in the specified collection to this collection (optional operation). This implementation iterates over the specified collection, and adds each object returned by the iterator to this collection, in turn. |
| void | [clear](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/AbstractCollection.html#clear())() Removes all of the elements from this collection (optional operation). This implementation iterates over this collection, removing each element using the Iterator.remove operation. |
| boolean | [contains](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/AbstractCollection.html#contains(java.lang.Object))([Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) o) Returns true if this collection contains the specified element. This implementation iterates over the elements in the collection, checking each element in turn for equality with the specified element. |
| boolean | [containsAll](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/AbstractCollection.html#containsAll(java.util.Collection<?>))([Collection](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Collection.html)\<?\> c) Returns true if this collection contains all of the elements in the specified collection. This implementation iterates over the specified collection, checking each element returned by the iterator in turn to see if it's contained in this collection. |
| boolean | [isEmpty](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/AbstractCollection.html#isEmpty())() Returns true if this collection contains no elements. This implementation returns size() == 0. |
| abstract [Iterator](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Iterator.html)\<E\> | [iterator](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/AbstractCollection.html#iterator())() Returns an iterator over the elements contained in this collection. |
| boolean | [remove](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/AbstractCollection.html#remove(java.lang.Object))([Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) o) Removes a single instance of the specified element from this collection, if it is present (optional operation). This implementation iterates over the collection looking for the specified element. |
| boolean | [removeAll](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/AbstractCollection.html#removeAll(java.util.Collection<?>))([Collection](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Collection.html)\<?\> c) Removes all of this collection's elements that are also contained in the specified collection (optional operation). This implementation iterates over this collection, checking each element returned by the iterator in turn to see if it's contained in the specified collection. |
| boolean | [retainAll](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/AbstractCollection.html#retainAll(java.util.Collection<?>))([Collection](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Collection.html)\<?\> c) Retains only the elements in this collection that are contained in the specified collection (optional operation). This implementation iterates over this collection, checking each element returned by the iterator in turn to see if it's contained in the specified collection. |
| abstract int | [size](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/AbstractCollection.html#size())() Returns the number of elements in this collection. |
| \<T\> T\[\] | [toArray](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/AbstractCollection.html#toArray(T[]))(T\[\] contents) Returns an array containing all of the elements in this collection; the runtime type of the returned array is that of the specified array. This implementation returns an array containing all the elements returned by this collection's iterator in the same order, stored in consecutive elements of the array, starting with index `0`. |
| [Object\[\]](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) | [toArray](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/AbstractCollection.html#toArray())() Returns an array containing all of the elements in this collection. This implementation returns an array containing all the elements returned by this collection's iterator, in the same order, stored in consecutive elements of the array, starting with index `0`. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [toString](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/AbstractCollection.html#toString())() Returns a string representation of this collection. |

From class [java.lang.Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)

|---|---|
| [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) | [clone](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#clone())() Creates and returns a copy of this `Object`. |
| boolean | [equals](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#equals(java.lang.Object))([Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) obj) Compares this instance with the specified object and indicates if they are equal. |
| void | [finalize](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#finalize())() Invoked when the garbage collector has detected that this instance is no longer reachable. |
| final [Class](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html)\<?\> | [getClass](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#getClass())() Returns the unique instance of `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html` that represents this object's class. |
| int | [hashCode](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#hashCode())() Returns an integer hash code for this object. |
| final void | [notify](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#notify())() Causes a thread which is waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |
| final void | [notifyAll](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#notifyAll())() Causes all threads which are waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [toString](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#toString())() Returns a string containing a concise, human-readable description of this object. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait(long,%20int))(long timeout, int nanos) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait(long))(long timeout) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait())() Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object. |

From interface [java.util.Collection](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Collection.html)

|---|---|
| abstract boolean | [add](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Collection.html#add(E))(E e) Ensures that this collection contains the specified element (optional operation). |
| abstract boolean | [addAll](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Collection.html#addAll(java.util.Collection<?%20extends%20E>))([Collection](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Collection.html)\<? extends E\> c) Adds all of the elements in the specified collection to this collection (optional operation). |
| abstract void | [clear](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Collection.html#clear())() Removes all of the elements from this collection (optional operation). |
| abstract boolean | [contains](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Collection.html#contains(java.lang.Object))([Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) o) Returns true if this collection contains the specified element. |
| abstract boolean | [containsAll](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Collection.html#containsAll(java.util.Collection<?>))([Collection](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Collection.html)\<?\> c) Returns true if this collection contains all of the elements in the specified collection. |
| abstract boolean | [equals](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Collection.html#equals(java.lang.Object))([Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) o) Compares the specified object with this collection for equality. |
| abstract int | [hashCode](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Collection.html#hashCode())() Returns the hash code value for this collection. |
| abstract boolean | [isEmpty](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Collection.html#isEmpty())() Returns true if this collection contains no elements. |
| abstract [Iterator](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Iterator.html)\<E\> | [iterator](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Collection.html#iterator())() Returns an iterator over the elements in this collection. |
| [Stream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Stream.html)\<E\> | [parallelStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Collection.html#parallelStream())() Returns a possibly parallel `Stream` with this collection as its source. |
| abstract boolean | [remove](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Collection.html#remove(java.lang.Object))([Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) o) Removes a single instance of the specified element from this collection, if it is present (optional operation). |
| abstract boolean | [removeAll](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Collection.html#removeAll(java.util.Collection<?>))([Collection](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Collection.html)\<?\> c) Removes all of this collection's elements that are also contained in the specified collection (optional operation). |
| boolean | [removeIf](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Collection.html#removeIf(java.util.function.Predicate<?%20super%20E>))([Predicate](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Predicate.html)\<? super E\> filter) Removes all of the elements of this collection that satisfy the given predicate. |
| abstract boolean | [retainAll](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Collection.html#retainAll(java.util.Collection<?>))([Collection](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Collection.html)\<?\> c) Retains only the elements in this collection that are contained in the specified collection (optional operation). |
| abstract int | [size](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Collection.html#size())() Returns the number of elements in this collection. |
| [Spliterator](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.html)\<E\> | [spliterator](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Collection.html#spliterator())() Creates a `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.html` over the elements in this collection. |
| [Stream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Stream.html)\<E\> | [stream](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Collection.html#stream())() Returns a sequential `Stream` with this collection as its source. |
| abstract \<T\> T\[\] | [toArray](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Collection.html#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 [Object\[\]](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) | [toArray](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Collection.html#toArray())() Returns an array containing all of the elements in this collection. |

From interface [java.util.Set](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Set.html)

|---|---|
| abstract boolean | [add](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Set.html#add(E))(E e) Adds the specified element to this set if it is not already present (optional operation). |
| abstract boolean | [addAll](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Set.html#addAll(java.util.Collection<?%20extends%20E>))([Collection](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Collection.html)\<? 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 | [clear](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Set.html#clear())() Removes all of the elements from this set (optional operation). |
| abstract boolean | [contains](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Set.html#contains(java.lang.Object))([Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) o) Returns `true` if this set contains the specified element. |
| abstract boolean | [containsAll](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Set.html#containsAll(java.util.Collection<?>))([Collection](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Collection.html)\<?\> c) Returns `true` if this set contains all of the elements of the specified collection. |
| abstract boolean | [equals](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Set.html#equals(java.lang.Object))([Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) o) Compares the specified object with this set for equality. |
| abstract int | [hashCode](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Set.html#hashCode())() Returns the hash code value for this set. |
| abstract boolean | [isEmpty](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Set.html#isEmpty())() Returns `true` if this set contains no elements. |
| abstract [Iterator](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Iterator.html)\<E\> | [iterator](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Set.html#iterator())() Returns an iterator over the elements in this set. |
| abstract boolean | [remove](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Set.html#remove(java.lang.Object))([Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) o) Removes the specified element from this set if it is present (optional operation). |
| abstract boolean | [removeAll](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Set.html#removeAll(java.util.Collection<?>))([Collection](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Collection.html)\<?\> c) Removes from this set all of its elements that are contained in the specified collection (optional operation). |
| abstract boolean | [retainAll](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Set.html#retainAll(java.util.Collection<?>))([Collection](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Collection.html)\<?\> c) Retains only the elements in this set that are contained in the specified collection (optional operation). |
| abstract int | [size](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Set.html#size())() Returns the number of elements in this set (its cardinality). |
| [Spliterator](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.html)\<E\> | [spliterator](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Set.html#spliterator())() Creates a `Spliterator` over the elements in this set. |
| abstract \<T\> T\[\] | [toArray](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Set.html#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. |
| abstract [Object\[\]](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) | [toArray](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Set.html#toArray())() Returns an array containing all of the elements in this set. |

From interface [java.lang.Iterable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Iterable.html)

|---|---|
| void | [forEach](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Iterable.html#forEach(java.util.function.Consumer<?%20super%20T>))([Consumer](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Consumer.html)\<? 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 [Iterator](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Iterator.html)\<E\> | [iterator](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Iterable.html#iterator())() Returns an iterator over elements of type `T`. |
| [Spliterator](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.html)\<E\> | [spliterator](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Iterable.html#spliterator())() Creates a `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.html` over the elements described by this `Iterable`. |

## Protected Constructors

#### protected
**AbstractSet**
()

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

## Public Methods

#### public boolean
**equals**
([Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) 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).

##### Parameters

| o | object to be compared for equality with this set |
|---|---|

##### Returns

- true if the specified object is equal to this set

#### 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://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#hashCode()`.

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

##### Returns

- the hash code value for this set

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#equals(java.lang.Object)`
- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Set.html#equals(java.lang.Object)`

#### public boolean
**removeAll**
([Collection](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Collection.html)\<?\> 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.

##### Parameters

| c | collection containing elements to be removed from this set |
|---|---|

##### Returns

- true if this set changed as a result of the call

##### Throws

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

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/AbstractCollection.html#remove(java.lang.Object)`
- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/AbstractCollection.html#contains(java.lang.Object)`