@GwtCompatible(serializable=true, emulated=true) public final class HashMultiset<E> extends AbstractMapBasedMultiset<E>
HashMap
.AbstractMultiset.ElementSet, AbstractMultiset.EntrySet
Multiset.Entry<E>
Modifier and Type | Field and Description |
---|---|
private static long |
serialVersionUID |
Modifier | Constructor and Description |
---|---|
private |
HashMultiset() |
private |
HashMultiset(int distinctElements) |
Modifier and Type | Method and Description |
---|---|
static <E> HashMultiset<E> |
create()
Creates a new, empty
HashMultiset using the default initial capacity. |
static <E> HashMultiset<E> |
create(int distinctElements)
Creates a new, empty
HashMultiset with the specified expected number of distinct
elements. |
static <E> HashMultiset<E> |
create(java.lang.Iterable<? extends E> elements)
Creates a new
HashMultiset containing the specified elements. |
private void |
readObject(java.io.ObjectInputStream stream) |
private void |
writeObject(java.io.ObjectOutputStream stream) |
add, clear, count, distinctElements, elementIterator, entryIterator, entrySet, forEachEntry, iterator, remove, setBackingMap, setCount, size
add, addAll, contains, createElementSet, createEntrySet, elementSet, equals, hashCode, isEmpty, remove, removeAll, retainAll, setCount, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
containsAll, forEach, spliterator
@GwtIncompatible private static final long serialVersionUID
private HashMultiset()
private HashMultiset(int distinctElements)
public static <E> HashMultiset<E> create()
HashMultiset
using the default initial capacity.public static <E> HashMultiset<E> create(int distinctElements)
HashMultiset
with the specified expected number of distinct
elements.distinctElements
- the expected number of distinct elementsjava.lang.IllegalArgumentException
- if distinctElements
is negativepublic static <E> HashMultiset<E> create(java.lang.Iterable<? extends E> elements)
HashMultiset
containing the specified elements.
This implementation is highly efficient when elements
is itself a Multiset
.
elements
- the elements that the multiset should contain@GwtIncompatible private void writeObject(java.io.ObjectOutputStream stream) throws java.io.IOException
java.io.IOException
@GwtIncompatible private void readObject(java.io.ObjectInputStream stream) throws java.io.IOException, java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException