See the Guava User Guide article on Multiset.
| Modifier and Type | Class and Description |
|---|---|
| pack-priv abstract class |
| Modifier and Type | Field and Description |
|---|---|
| private transient int[] | |
| private transient int | |
| private transient E[] | |
| private static final long | |
| private transient long | |
| private transient Class |
| Access | Constructor and Description |
|---|---|
| private |
| 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. |
| private void | |
| public void | clear()
Implements abstract com. Implements java. |
| public int | count(Object
the element to count occurrences of element)Implements com. |
| public static <E extends Enum | |
| public static <E extends Enum | |
| public static <E extends Enum | |
| pack-priv int | |
| pack-priv Iterator | |
| pack-priv Iterator | |
| public void | forEachEntry(ObjIntConsumer<? super E> action)
Overrides default com. |
| private boolean | |
| 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. |
| 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. |
| private void |
| counts | back to summary |
|---|---|
| private transient int[] counts | |
| distinctElements | back to summary |
|---|---|
| private transient int distinctElements | |
| enumConstants | back to summary |
|---|---|
| private transient E[] enumConstants | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID
| |
| size | back to summary |
|---|---|
| private transient long size | |
| type | back to summary |
|---|---|
| private transient Class<E> type | |
| EnumMultiset | back to summary |
|---|---|
| private EnumMultiset(Class<E> type) Creates an empty | |
| 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
| |
| checkIsE | back to summary |
|---|---|
| private void checkIsE(Object element) Returns | |
| 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 | |
| create | back to summary |
|---|---|
| public static <E extends Enum Creates an empty | |
| create | back to summary |
|---|---|
| public static <E extends Enum Creates a new This implementation is highly efficient when
| |
| create | back to summary |
|---|---|
| public static <E extends Enum Returns a new
| |
| 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.
| |
| 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
| |
| isActuallyE | back to summary |
|---|---|
| private boolean isActuallyE(Object o) | |
| 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.
| |
| readObject | back to summary |
|---|---|
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException
| |
| 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
| |
| 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
| |
| writeObject | back to summary |
|---|---|
private void writeObject(ObjectOutputStream stream) throws IOException
| |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | |
| public T | |
| pack-priv abstract T | |
| public void | remove()
Overrides default java. |
| index | back to summary |
|---|---|
| pack-priv int index | |
| toRemove | back to summary |
|---|---|
| pack-priv int toRemove | |
| Itr | back to summary |
|---|---|
| pack-priv Itr() | |
| hasNext | back to summary |
|---|---|
| public boolean hasNext() Implements java. Doc from java. Returns
| |
| next | back to summary |
|---|---|
| public T next() Implements java. Doc from java. Returns the next element in the iteration.
| |
| output | back to summary |
|---|---|
| pack-priv abstract T output(int index) | |
| 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
| |