docs/doc/reference/com/google/android/exoplayer2/util/CopyOnWriteMultiset.html
Package com.google.android.exoplayer2.util
Type Parameters:E - The type of element being stored.All Implemented Interfaces:Iterable<E>
[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public final classCopyOnWriteMultiset\<E\>extends[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")implements[Iterable](https://developer.android.com/reference/java/lang/Iterable.html "class or interface in java.lang")<E>
Deprecated. com.google.android.exoplayer2 is deprecated. Please migrate to androidx.media3 (which contains the same ExoPlayer code). See the migration guide for more details, including a script to help with the migration.
An unordered collection of elements that allows duplicates, but also allows access to a set of unique elements.
This class is thread-safe using the same method as CopyOnWriteArrayList. Mutation methods cause the underlying data to be copied. elementSet() and iterator() return snapshots that are unaffected by subsequent mutations.
Iterating directly on this class reveals duplicate elements. Unique elements can be accessed via elementSet(). Iteration order for both of these is not defined.
Constructors | Constructor | Description |
| --- | --- |
| CopyOnWriteMultiset() |
Deprecated.
|
All Methods Instance Methods Concrete Methods Deprecated Methods | Modifier and Type | Method | Description |
| --- | --- | --- |
| void | add(E element) |
Deprecated.
Adds element to the multiset.
|
| int | count(E element) |
Deprecated.
Returns the number of occurrences of an element in this multiset.
|
| Set<E> | elementSet() |
Deprecated.
Returns a snapshot of the unique elements currently in this multiset.
|
| Iterator<E> | iterator() |
Deprecated.
Returns an iterator over a snapshot of all the elements currently in this multiset (including duplicates).
|
| void | remove(E element) |
Deprecated.
Removes element from the multiset.
|
-
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
forEach, spliterator
-
public CopyOnWriteMultiset()
Deprecated.
-
public void add([E](CopyOnWriteMultiset.html "type parameter in CopyOnWriteMultiset")element)
Deprecated.
Adds element to the multiset.
Parameters:element - The element to be added.
-
public void remove([E](CopyOnWriteMultiset.html "type parameter in CopyOnWriteMultiset")element)
Deprecated.
Removes element from the multiset.
Parameters:element - The element to be removed.
-
public[Set](https://developer.android.com/reference/java/util/Set.html "class or interface in java.util")<[E](CopyOnWriteMultiset.html "type parameter in CopyOnWriteMultiset")> elementSet()
Deprecated.
Returns a snapshot of the unique elements currently in this multiset.
Changes to the underlying multiset are not reflected in the returned value.
Returns:An unmodifiable set containing the unique elements in this multiset.
-
public[Iterator](https://developer.android.com/reference/java/util/Iterator.html "class or interface in java.util")<[E](CopyOnWriteMultiset.html "type parameter in CopyOnWriteMultiset")> iterator()
Deprecated.
Returns an iterator over a snapshot of all the elements currently in this multiset (including duplicates).
Changes to the underlying multiset are not reflected in the returned value.
Specified by:iterator in interface Iterable<E>Returns:An unmodifiable iterator over all the elements in this multiset (including duplicates).
-
public int count([E](CopyOnWriteMultiset.html "type parameter in CopyOnWriteMultiset")element)
Deprecated.
Returns the number of occurrences of an element in this multiset.