class ImmutableMultimap.Keys extends ImmutableMultiset<K>
ImmutableMultiset.Builder<E>, ImmutableMultiset.EntrySetSerializedForm<E>
ImmutableCollection.ArrayBasedBuilder<E>
Multiset.Entry<E>
Constructor and Description |
---|
Keys() |
Modifier and Type | Method and Description |
---|---|
boolean |
contains(java.lang.Object object)
Determines whether this multiset contains the specified element.
|
int |
count(java.lang.Object element)
Returns the number of occurrences of an element in this multiset (the
count of the element).
|
java.util.Set<K> |
elementSet()
Returns the set of distinct elements contained in this multiset.
|
(package private) Multiset.Entry<K> |
getEntry(int index) |
(package private) boolean |
isPartialView()
Returns
true if this immutable collection's implementation contains references to
user-created objects that aren't accessible via this collection's methods. |
int |
size() |
add, builder, containsAll, copyFromEntries, copyIntoArray, copyOf, copyOf, copyOf, entrySet, equals, hashCode, iterator, of, of, of, of, of, of, of, remove, setCount, setCount, toString, writeReplace
add, addAll, asList, clear, createAsList, remove, removeAll, retainAll, toArray, toArray
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
add, remove, removeAll, retainAll
public boolean contains(@Nullable java.lang.Object object)
Multiset
This method refines Collection.contains(java.lang.Object)
to further specify that
it may not throw an exception in response to element
being
null or of the wrong type.
public int count(@Nullable java.lang.Object element)
Multiset
Object.equals(java.lang.Object)
-based
multiset, this gives the same result as Collections.frequency(java.util.Collection<?>, java.lang.Object)
(which would presumably perform more poorly).
Note: the utility method Iterables.frequency(java.lang.Iterable<?>, java.lang.Object)
generalizes
this operation; it correctly delegates to this method when dealing with a
multiset, but it can also accept any other iterable type.
element
- the element to count occurrences ofpublic java.util.Set<K> elementSet()
Multiset
If the element set supports any removal operations, these necessarily cause all occurrences of the removed element(s) to be removed from the multiset. Implementations are not expected to support the add operations, although this is possible.
A common use for the element set is to find the number of distinct
elements in the multiset: elementSet().size()
.
public int size()
Multiset.Entry<K> getEntry(int index)
getEntry
in class ImmutableMultiset<K>
boolean isPartialView()
ImmutableCollection
true
if this immutable collection's implementation contains references to
user-created objects that aren't accessible via this collection's methods. This is generally
used to determine whether copyOf
implementations should make an explicit copy to avoid
memory leaks.isPartialView
in class ImmutableCollection<K>