final class RegularImmutableSortedMultiset<E> extends ImmutableSortedMultiset<E>
ImmutableSortedMultiset.Builder<E>
ImmutableMultiset.EntrySetSerializedForm<E>
ImmutableCollection.ArrayBasedBuilder<E>
Multiset.Entry<E>
Modifier and Type | Field and Description |
---|---|
private int[] |
counts |
private long[] |
cumulativeCounts |
private RegularImmutableSortedSet<E> |
elementSet |
private int |
length |
private int |
offset |
descendingMultiset
Constructor and Description |
---|
RegularImmutableSortedMultiset(RegularImmutableSortedSet<E> elementSet,
int[] counts,
long[] cumulativeCounts,
int offset,
int length) |
Modifier and Type | Method and Description |
---|---|
int |
count(java.lang.Object element)
Returns the number of occurrences of an element in this multiset (the
count of the element).
|
ImmutableSortedSet<E> |
elementSet()
Returns a
NavigableSet view of the distinct elements in this multiset. |
Multiset.Entry<E> |
firstEntry()
Returns the entry of the first element in this multiset, or
null if
this multiset is empty. |
(package private) Multiset.Entry<E> |
getEntry(int index) |
(package private) ImmutableSortedMultiset<E> |
getSubMultiset(int from,
int to) |
ImmutableSortedMultiset<E> |
headMultiset(E upperBound,
BoundType boundType)
Returns a view of this multiset restricted to the elements less than
upperBound , optionally including upperBound itself. |
(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. |
Multiset.Entry<E> |
lastEntry()
Returns the entry of the last element in this multiset, or
null if
this multiset is empty. |
int |
size() |
ImmutableSortedMultiset<E> |
tailMultiset(E lowerBound,
BoundType boundType)
Returns a view of this multiset restricted to the elements greater than
lowerBound , optionally including lowerBound itself. |
comparator, copyOf, copyOf, copyOf, copyOf, copyOf, copyOfSorted, descendingMultiset, emptyMultiset, naturalOrder, of, of, of, of, of, of, of, orderedBy, pollFirstEntry, pollLastEntry, reverseOrder, subMultiset, writeReplace
builder
add, contains, containsAll, copyFromEntries, copyIntoArray, entrySet, equals, hashCode, iterator, remove, setCount, setCount, toString
add, addAll, asList, clear, createAsList, remove, removeAll, retainAll, toArray, toArray
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
entrySet, iterator
add, add, contains, containsAll, equals, hashCode, remove, remove, removeAll, retainAll, setCount, setCount, toString
private final transient RegularImmutableSortedSet<E> elementSet
private final transient int[] counts
private final transient long[] cumulativeCounts
private final transient int offset
private final transient int length
RegularImmutableSortedMultiset(RegularImmutableSortedSet<E> elementSet, int[] counts, long[] cumulativeCounts, int offset, int length)
Multiset.Entry<E> getEntry(int index)
getEntry
in class ImmutableMultiset<E>
public Multiset.Entry<E> firstEntry()
SortedMultiset
null
if
this multiset is empty.public Multiset.Entry<E> lastEntry()
SortedMultiset
null
if
this multiset is empty.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 int size()
public ImmutableSortedSet<E> elementSet()
SortedMultiset
NavigableSet
view of the distinct elements in this multiset.elementSet
in interface Multiset<E>
elementSet
in interface SortedMultiset<E>
elementSet
in interface SortedMultisetBridge<E>
elementSet
in class ImmutableSortedMultiset<E>
public ImmutableSortedMultiset<E> headMultiset(E upperBound, BoundType boundType)
SortedMultiset
upperBound
, optionally including upperBound
itself. The
returned multiset is a view of this multiset, so changes to one will be
reflected in the other. The returned multiset supports all operations that
this multiset supports.
The returned multiset will throw an IllegalArgumentException
on
attempts to add elements outside its range.
headMultiset
in interface SortedMultiset<E>
headMultiset
in class ImmutableSortedMultiset<E>
public ImmutableSortedMultiset<E> tailMultiset(E lowerBound, BoundType boundType)
SortedMultiset
lowerBound
, optionally including lowerBound
itself. The
returned multiset is a view of this multiset, so changes to one will be
reflected in the other. The returned multiset supports all operations that
this multiset supports.
The returned multiset will throw an IllegalArgumentException
on
attempts to add elements outside its range.
tailMultiset
in interface SortedMultiset<E>
tailMultiset
in class ImmutableSortedMultiset<E>
ImmutableSortedMultiset<E> getSubMultiset(int from, int to)
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<E>