Multiset<E> backed by an instance of Map<E, Count>.
For serialization to work, the subclass must specify explicit readObject and writeObject methods.
| Modifier and Type | Class and Description |
|---|---|
| private class |
| Modifier and Type | Field and Description |
|---|---|
| private transient Map | |
| private static final long | |
| private transient long |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| public int | add(E
the element to add occurrences of; may be null only if explicitly allowed by the
implementation element, int the number of occurrences of the element to add. May be zero, in which case
no change will be made. occurrences)Overrides com. Implements com. |
| public void | clear()
Implements abstract com. Implements java. |
| public int | count(Object
the element to count occurrences of element)Implements com. |
| pack-priv int | |
| pack-priv Iterator | |
| pack-priv Iterator | |
| public Set | entrySet()
Overrides com. Implements com. Multiset.Entry instances,
each providing an element of the multiset and the count of that element.
|
| public void | forEachEntry(ObjIntConsumer<? super E> action)
Overrides default com. |
| private static int | |
| public Iterator | iterator()
Implements abstract java. Implements com. |
| private void | |
| public int | remove(Object
the element to conditionally remove occurrences of element, int the number of occurrences of the element to remove. May be zero, in which
case no change will be made. occurrences)Overrides com. Implements com. |
| pack-priv void | |
| public int | setCount(E
the element to add or remove occurrences of; may be null only if explicitly
allowed by the implementation element, int the desired count of the element in this multiset count)Overrides com. Implements com. |
| public int | size()
Implements abstract java. Implements com. |
| backingMap | back to summary |
|---|---|
| private transient Map<E, Count> backingMap | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID
| |
| size | back to summary |
|---|---|
| private transient long size | |
| AbstractMapBasedMultiset | back to summary |
|---|---|
| protected AbstractMapBasedMultiset(Map<E, Count> backingMap) Standard constructor. | |
| add | back to summary |
|---|---|
| public int add(E element, int occurrences) Overrides com. Implements com. Doc from com. Adds a number of occurrences of an element to this multiset. Note that if
| |
| clear | back to summary |
|---|---|
| public void clear() Implements abstract com. Implements java. Doc from java. Removes all of the elements from this collection (optional operation). The collection will be empty after this method returns.
| |
| count | back to summary |
|---|---|
| public int count(Object element) Implements com. Doc from com. Returns the number of occurrences of an element in this multiset (the count of the
element). Note that for an Note the utility method | |
| distinctElements | back to summary |
|---|---|
| pack-priv int distinctElements() Implements abstract com.
| |
| elementIterator | back to summary |
|---|---|
| pack-priv Iterator Implements abstract com.
| |
| entryIterator | back to summary |
|---|---|
| pack-priv Iterator Implements abstract com.
| |
| entrySet | back to summary |
|---|---|
| public Set Overrides com. Implements com. Doc from com. Returns a view of the contents of this multiset, grouped into The entry set is backed by the same data as the multiset, so any change to either is
immediately reflected in the other. However, multiset changes may or may not be reflected in
any Invoking | |
| forEachEntry | back to summary |
|---|---|
| public void forEachEntry(ObjIntConsumer<? super E> action) Overrides default com. Doc from com. Runs the specified action for each distinct element in this multiset, and the number of
occurrences of that element. For some
| |
| getAndSet | back to summary |
|---|---|
| private static int getAndSet(Count i, int count) | |
| iterator | back to summary |
|---|---|
| public Iterator Implements abstract java. Implements com. Doc from com. 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). Elements that occur multiple times in the multiset will appear multiple times in this iterator, though not necessarily sequentially.
| |
| readObjectNoData | back to summary |
|---|---|
private void readObjectNoData() throws ObjectStreamException
| |
| remove | back to summary |
|---|---|
| public int remove(Object element, int occurrences) Overrides com. Implements com. Doc from com. Removes a number of occurrences of the specified element from this multiset. If the multiset
contains fewer than this number of occurrences to begin with, all occurrences will be removed.
Note that if
| |
| setBackingMap | back to summary |
|---|---|
| pack-priv void setBackingMap(Map<E, Count> backingMap) Used during deserialization only. The backing map must be empty. | |
| setCount | back to summary |
|---|---|
| public int setCount(E element, int count) Overrides com. Implements com. Doc from com. Adds or removes the necessary occurrences of an element such that the element attains the desired count.
| |
| size | back to summary |
|---|---|
| public int size() Implements abstract java. Implements com. Doc from com. Returns the total number of all occurrences of all elements in this multiset. Note this method does not return the number of distinct elements in the
multiset, which is given by
| |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv boolean | |
| pack-priv Map. | |
| pack-priv final Iterator | |
| pack-priv int |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | |
| public E | |
| public void | remove()
Overrides default java. |
| canRemove | back to summary |
|---|---|
| pack-priv boolean canRemove | |
| currentEntry | back to summary |
|---|---|
| pack-priv Map. | |
| entryIterator | back to summary |
|---|---|
| pack-priv final Iterator<Map. | |
| occurrencesLeft | back to summary |
|---|---|
| pack-priv int occurrencesLeft | |
| MapBasedMultisetIterator | back to summary |
|---|---|
| pack-priv MapBasedMultisetIterator() | |
| hasNext | back to summary |
|---|---|
| public boolean hasNext() Implements java. Doc from java. Returns
| |
| next | back to summary |
|---|---|
| public E next() Implements java. Doc from java. Returns the next element in the iteration.
| |
| remove | back to summary |
|---|---|
| public void remove() Overrides default java. Doc from java. Removes from the underlying collection the last element returned
by this iterator (optional operation). This method can be called
only once per call to The behavior of an iterator is unspecified if the underlying collection is modified while the iteration is in progress in any way other than by calling this method, unless an overriding class has specified a concurrent modification policy.
The behavior of an iterator is unspecified if this method is called
after a call to the
| |