Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Methods](https://developer.android.com/reference/java/util/concurrent/ConcurrentHashMap.KeySetView#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/java/util/concurrent/ConcurrentHashMap.KeySetView#inhmethods)

# ConcurrentHashMap.KeySetView

` public static final class ConcurrentHashMap.KeySetView `   
` extends https://developer.android.com/reference/java/lang/Object ` ` implements https://developer.android.com/reference/java/util/Collection<K>, https://developer.android.com/reference/java/io/Serializable, https://developer.android.com/reference/java/util/Set<K> `

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | java.util.concurrent.ConcurrentHashMap.KeySetView\<K, V\> |

<br />

*** ** * ** ***

A view of a ConcurrentHashMap as a `https://developer.android.com/reference/java/util/Set` of keys, in which additions may optionally be enabled by mapping to a common value. This class cannot be directly instantiated. See `https://developer.android.com/reference/java/util/concurrent/ConcurrentHashMap#keySet(V)`, `https://developer.android.com/reference/java/util/concurrent/ConcurrentHashMap#newKeySet()`, `https://developer.android.com/reference/java/util/concurrent/ConcurrentHashMap#newKeySet(int)`.

## Summary

| ### Public methods ||
|---|---|
| ` boolean` | ` https://developer.android.com/reference/java/util/concurrent/ConcurrentHashMap.KeySetView#add(K)(K e) ` Adds the specified key to this set view by mapping the key to the default mapped value in the backing map, if defined. |
| ` boolean` | ` https://developer.android.com/reference/java/util/concurrent/ConcurrentHashMap.KeySetView#addAll(java.util.Collection<?%20extends%20K>)(https://developer.android.com/reference/java/util/Collection<? extends K> c) ` Adds all of the elements in the specified collection to this set, as if by calling `https://developer.android.com/reference/java/util/Set#add(E)` on each one. |
| ` void` | ` https://developer.android.com/reference/java/util/concurrent/ConcurrentHashMap.KeySetView#clear()() ` Removes all of the elements from this view, by removing all the mappings from the map backing this view. |
| ` boolean` | ` https://developer.android.com/reference/java/util/concurrent/ConcurrentHashMap.KeySetView#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/concurrent/ConcurrentHashMap.KeySetView#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/concurrent/ConcurrentHashMap.KeySetView#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object o) ` Indicates whether some other object is "equal to" this one. |
| ` void` | ` https://developer.android.com/reference/java/util/concurrent/ConcurrentHashMap.KeySetView#forEach(java.util.function.Consumer<?%20super%20K>)(https://developer.android.com/reference/java/util/function/Consumer<? super K> action) ` <br /> |
| ` https://developer.android.com/reference/java/util/concurrent/ConcurrentHashMap<K, V>` | ` https://developer.android.com/reference/java/util/concurrent/ConcurrentHashMap.KeySetView#getMap()() ` Returns the map backing this view. |
| ` V` | ` https://developer.android.com/reference/java/util/concurrent/ConcurrentHashMap.KeySetView#getMappedValue()() ` Returns the default mapped value for additions, or `null` if additions are not supported. |
| ` int` | ` https://developer.android.com/reference/java/util/concurrent/ConcurrentHashMap.KeySetView#hashCode()() ` Returns a hash code value for the object. |
| ` boolean` | ` https://developer.android.com/reference/java/util/concurrent/ConcurrentHashMap.KeySetView#isEmpty()() ` Returns `true` if this collection contains no elements. |
| ` https://developer.android.com/reference/java/util/Iterator<K>` | ` https://developer.android.com/reference/java/util/concurrent/ConcurrentHashMap.KeySetView#iterator()() ` Returns an iterator over the elements in this collection. |
| ` boolean` | ` https://developer.android.com/reference/java/util/concurrent/ConcurrentHashMap.KeySetView#remove(java.lang.Object)(https://developer.android.com/reference/java/lang/Object o) ` Removes the key from this map view, by removing the key (and its corresponding value) from the backing map. |
| ` boolean` | ` https://developer.android.com/reference/java/util/concurrent/ConcurrentHashMap.KeySetView#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/concurrent/ConcurrentHashMap.KeySetView#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). |
| ` int` | ` https://developer.android.com/reference/java/util/concurrent/ConcurrentHashMap.KeySetView#size()() ` Returns the number of elements in this collection. |
| ` https://developer.android.com/reference/java/util/Spliterator<K>` | ` https://developer.android.com/reference/java/util/concurrent/ConcurrentHashMap.KeySetView#spliterator()() ` Creates a `https://developer.android.com/reference/java/util/Spliterator` over the elements in this collection. |
| ` <T> T[]` | ` https://developer.android.com/reference/java/util/concurrent/ConcurrentHashMap.KeySetView#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/concurrent/ConcurrentHashMap.KeySetView#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/concurrent/ConcurrentHashMap.KeySetView#toString()() ` Returns a string representation of this collection. |

### Inherited methods

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)(K 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<K>` ` 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<K>` ` 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<K>` ` 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<K>` ` 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)(K 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<K>` ` 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/concurrent/ConcurrentHashMap.KeySetView#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<K>` ` 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<K>` ` https://developer.android.com/reference/java/util/Set#of(E,%20E,%20E)(K e1, K e2, K e3) `

Returns an unmodifiable set containing three elements.
` static <E> https://developer.android.com/reference/java/util/Set<K>` ` https://developer.android.com/reference/java/util/Set#of(E,%20E,%20E,%20E,%20E,%20E,%20E,%20E,%20E)(K e1, K e2, K e3, K e4, K e5, K e6, K e7, K e8, K e9) `

Returns an unmodifiable set containing nine elements.
` static <E> https://developer.android.com/reference/java/util/Set<K>` ` https://developer.android.com/reference/java/util/Set#of(E,%20E,%20E,%20E,%20E)(K e1, K e2, K e3, K e4, K e5) `

Returns an unmodifiable set containing five elements.
` static <E> https://developer.android.com/reference/java/util/Set<K>` ` https://developer.android.com/reference/java/util/Set#of(E,%20E,%20E,%20E,%20E,%20E)(K e1, K e2, K e3, K e4, K e5, K e6) `

Returns an unmodifiable set containing six elements.
` static <E> https://developer.android.com/reference/java/util/Set<K>` ` https://developer.android.com/reference/java/util/Set#of(E,%20E,%20E,%20E,%20E,%20E,%20E,%20E)(K e1, K e2, K e3, K e4, K e5, K e6, K e7, K e8) `

Returns an unmodifiable set containing eight elements.
` static <E> https://developer.android.com/reference/java/util/Set<K>` ` 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<K>` ` 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<K>` ` https://developer.android.com/reference/java/util/Set#of(E,%20E,%20E,%20E,%20E,%20E,%20E,%20E,%20E,%20E)(K e1, K e2, K e3, K e4, K e5, K e6, K e7, K e8, K e9, K e10) `

Returns an unmodifiable set containing ten elements.
` static <E> https://developer.android.com/reference/java/util/Set<K>` ` https://developer.android.com/reference/java/util/Set#of(E,%20E)(K e1, K e2) `

Returns an unmodifiable set containing two elements.
` static <E> https://developer.android.com/reference/java/util/Set<K>` ` https://developer.android.com/reference/java/util/Set#of(E,%20E,%20E,%20E,%20E,%20E,%20E)(K e1, K e2, K e3, K e4, K e5, K e6, K e7) `

Returns an unmodifiable set containing seven elements.
` static <E> https://developer.android.com/reference/java/util/Set<K>` ` https://developer.android.com/reference/java/util/Set#of(E,%20E,%20E,%20E)(K e1, K e2, K e3, K e4) `

Returns an unmodifiable set containing four elements.
` static <E> https://developer.android.com/reference/java/util/Set<K>` ` https://developer.android.com/reference/java/util/Set#of(E)(K 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<K>` ` 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<K>` ` 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<K>` ` 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`.
From interface ` https://developer.android.com/reference/java/util/Collection ` ` abstract boolean` ` https://developer.android.com/reference/java/util/Collection#add(E)(K 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<K>` ` 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<K>` ` 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<K>` ` 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<K>` ` 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.

## Public methods

### add

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

```
public boolean add (K e)
```

Adds the specified key to this set view by mapping the key to the default mapped value in the backing map, if defined.

<br />

| Parameters ||
|---|---|
| `e` | `K`: key to be added <br /> |

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

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/NullPointerException` | if the specified key is null |
| `https://developer.android.com/reference/java/lang/UnsupportedOperationException` | if no default mapped value for additions was provided |

### addAll

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

```
public boolean addAll (Collection<? extends K> c)
```

Adds all of the elements in the specified collection to this set, as if by calling `https://developer.android.com/reference/java/util/Set#add(E)` on each one.

<br />

| Parameters ||
|---|---|
| `c` | `Collection`: the elements to be inserted into 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/NullPointerException` | if the collection or any of its elements are `null` |
| `https://developer.android.com/reference/java/lang/UnsupportedOperationException` | if no default mapped value for additions was provided |

### clear

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

```
public void clear ()
```

Removes all of the elements from this view, by removing all the mappings from the map backing this view.

<br />

### contains

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

```
public boolean contains (Object o)
```

Returns `true` if this collection contains the specified element. More formally, returns `true` if and only if this collection contains at least one element `e` such that `Objects.equals(o, e)`.

<br />

| Parameters ||
|---|---|
| `o` | `Object`: element whose presence in this collection is to be tested <br /> |

| Returns ||
|---|---|
| `boolean` | `true` if this collection contains the specified element <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/NullPointerException` | if the specified key is null |

### containsAll

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

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

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

<br />

| Parameters ||
|---|---|
| `c` | `Collection`: collection to be checked for containment in this collection <br /> |

| Returns ||
|---|---|
| `boolean` | `true` if this collection contains all of the elements in the specified collection <br /> |

### equals

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

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

Indicates whether some other object is "equal to" this one.

The `equals` method implements an equivalence relation on non-null object references:

- It is *reflexive*: for any non-null reference value `x`, `x.equals(x)` should return `true`.
- It is *symmetric*: for any non-null reference values `x` and `y`, `x.equals(y)` should return `true` if and only if `y.equals(x)` returns `true`.
- It is *transitive*: for any non-null reference values `x`, `y`, and `z`, if `x.equals(y)` returns `true` and `y.equals(z)` returns `true`, then `x.equals(z)` should return `true`.
- It is *consistent*: for any non-null reference values `x` and `y`, multiple invocations of `x.equals(y)` consistently return `true` or consistently return `false`, provided no information used in `equals` comparisons on the objects is modified.
- For any non-null reference value `x`, `x.equals(null)` should return `false`.

An equivalence relation partitions the elements it operates on into *equivalence classes*; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

<br />

| Parameters ||
|---|---|
| `o` | `Object`: the reference object with which to compare. <br /> |

| Returns ||
|---|---|
| `boolean` | `true` if this object is the same as the obj argument; `false` otherwise. <br /> |

### forEach

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

```
public void forEach (Consumer<? super K> action)
```

<br />

<br />

| Parameters ||
|---|---|
| `action` | `Consumer` <br /> |

### getMap

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

```
public ConcurrentHashMap<K, V> getMap ()
```

Returns the map backing this view.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/util/concurrent/ConcurrentHashMap<K, V>` | the map backing this view <br /> |

### getMappedValue

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

```
public V getMappedValue ()
```

Returns the default mapped value for additions, or `null` if additions are not supported.

<br />

| Returns ||
|---|---|
| `V` | the default mapped value for additions, or `null` if not supported <br /> |

### hashCode

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

```
public int hashCode ()
```

Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by `https://developer.android.com/reference/java/util/HashMap`.

The general contract of `hashCode` is:

- Whenever it is invoked on the same object more than once during an execution of a Java application, the `hashCode` method must consistently return the same integer, provided no information used in `equals` comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
- If two objects are equal according to the `https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)` method, then calling the `hashCode` method on each of the two objects must produce the same integer result.
- It is *not* required that if two objects are unequal according to the `https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)` method, then calling the `hashCode` method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.

<br />

<br />

| Returns ||
|---|---|
| `int` | a hash code value for this object. <br /> |

### isEmpty

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

```
public boolean isEmpty ()
```

Returns `true` if this collection contains no elements.

<br />

| Returns ||
|---|---|
| `boolean` | `true` if this collection contains no elements <br /> |

### iterator

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

```
public Iterator<K> iterator ()
```

Returns an iterator over the elements in this collection. There are no guarantees concerning the order in which the elements are returned (unless this collection is an instance of some class that provides a guarantee).

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/util/Iterator<K>` | an iterator over the keys of the backing map <br /> |

### remove

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

```
public boolean remove (Object o)
```

Removes the key from this map view, by removing the key (and its corresponding value) from the backing map. This method does nothing if the key is not in the map.

<br />

| Parameters ||
|---|---|
| `o` | `Object`: the key to be removed from the backing map <br /> |

| Returns ||
|---|---|
| `boolean` | `true` if the backing map contained the specified key <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/NullPointerException` | if the specified key is null |

### removeAll

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

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

Removes all of this collection's elements that are also contained in the specified collection (optional operation). After this call returns, this collection will contain no elements in common with the specified collection.

<br />

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

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

### retainAll

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

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

Retains only the elements in this collection that are contained in the specified collection (optional operation). In other words, removes from this collection all of its elements that are not contained in the specified collection.

<br />

| Parameters ||
|---|---|
| `c` | `Collection`: collection containing elements to be retained in this collection <br /> |

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

### size

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

```
public int size ()
```

Returns the number of elements in this collection. If this collection contains more than `Integer.MAX_VALUE` elements, returns `Integer.MAX_VALUE`.

<br />

| Returns ||
|---|---|
| `int` | the number of elements in this collection <br /> |

### spliterator

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

```
public Spliterator<K> spliterator ()
```

Creates a `https://developer.android.com/reference/java/util/Spliterator` over the elements in this collection. Implementations should document characteristic values reported by the spliterator. Such characteristic values are not required to be reported if the spliterator reports `https://developer.android.com/reference/java/util/Spliterator#SIZED` and this collection contains no elements.

The default implementation should be overridden by subclasses that can return a more efficient spliterator. In order to preserve expected laziness behavior for the `https://developer.android.com/reference/java/util/Collection#stream()` and `https://developer.android.com/reference/java/util/Collection#parallelStream()` methods, spliterators should either have the characteristic of `IMMUTABLE` or `CONCURRENT`, or be *[late-binding](https://developer.android.com/reference/java/util/concurrent/Spliterator#binding)* . If none of these is practical, the overriding class should describe the spliterator's documented policy of binding and structural interference, and should override the `https://developer.android.com/reference/java/util/Collection#stream()` and `https://developer.android.com/reference/java/util/Collection#parallelStream()` methods to create streams using a `Supplier` of the spliterator, as in:

    Stream<E> s = StreamSupport.stream(() -> spliterator(), spliteratorCharacteristics)

These requirements ensure that streams produced by the `https://developer.android.com/reference/java/util/Collection#stream()` and `https://developer.android.com/reference/java/util/Collection#parallelStream()` methods will reflect the contents of the collection as of initiation of the terminal stream operation.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/util/Spliterator<K>` | a `Spliterator` over the elements in this collection <br /> |

### toArray

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

```
public 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. If the collection fits in the specified array, it is returned therein. Otherwise, a new array is allocated with the runtime type of the specified array and the size of this collection.

If this collection fits in the specified array with room to spare (i.e., the array has more elements than this collection), the element in the array immediately following the end of the collection is set to `null`. (This is useful in determining the length of this collection *only* if the caller knows that this collection does not contain any `null` elements.)

If this collection makes any guarantees as to what order its elements are returned by its iterator, this method must return the elements in the same order.

<br />

| Parameters ||
|---|---|
| `a` | `T`: the array into which the elements of this collection are to be stored, if it is big enough; otherwise, a new array of the same runtime type is allocated for this purpose. <br /> |

| Returns ||
|---|---|
| `T[]` | an array containing all of the elements in this collection <br /> |

### toArray

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

```
public Object[] toArray ()
```

Returns an array containing all of the elements in this collection. If this collection makes any guarantees as to what order its elements are returned by its iterator, this method must return the elements in the same order. The returned array's [runtime component type](https://developer.android.com/reference/java/lang/Class#getComponentType()) is `Object`.

The returned array will be "safe" in that no references to it are maintained by this collection. (In other words, this method must allocate a new array even if this collection is backed by an array). The caller is thus free to modify the returned array.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/Object` | an array, whose [runtime component type](https://developer.android.com/reference/java/lang/Class#getComponentType()) is `Object`, containing all of the elements in this collection <br /> |

### toString

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

```
public String toString ()
```

Returns a string representation of this collection. The string representation consists of the string representations of the collection's elements in the order they are returned by its iterator, enclosed in square brackets (`"[]"`). Adjacent elements are separated by the characters `", "` (comma and space). Elements are converted to strings as by `https://developer.android.com/reference/java/lang/String#valueOf(java.lang.Object)`.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | a string representation of this collection <br /> |