Top Description Fields Constructors Methods
com.google.common.collect

pack-priv final Class RegularImmutableSortedMultiset<E>

extends ImmutableSortedMultiset<E>
Class Inheritance
Annotations
@SuppressWarnings:serial
@GwtIncompatible
@ElementTypesAreNonnullByDefault
Static Imports
com.google.common.base.Preconditions.checkNotNull, .Preconditions.checkPositionIndexes, com.google.common.collect.BoundType.CLOSED

An immutable sorted multiset with one or more distinct elements.
Author
Louis Wasserman

Field Summary

Modifier and TypeField and Description
private final transient long[]
pack-priv final transient RegularImmutableSortedSet<E>
private final transient int
pack-priv static final ImmutableSortedMultiset<?>
private final transient int
private static final long[]
Inherited from com.google.common.collect.ImmutableSortedMultiset:
descendingMultiset

Constructor Summary

AccessConstructor and Description
pack-priv
pack-priv
RegularImmutableSortedMultiset(RegularImmutableSortedSet<E> elementSet, long[] cumulativeCounts, int offset, int length)

Method Summary

Modifier and TypeMethod and Description
public int
count(Object
the element to count occurrences of
element
)

Implements com.google.common.collect.Multiset.count.

Returns the number of occurrences of an element in this multiset (the count of the element).
public ImmutableSortedSet<E>
public Multiset.Entry<E>
firstEntry()

Implements com.google.common.collect.SortedMultiset.firstEntry.

Returns the entry of the first element in this multiset, or null if this multiset is empty.
public void
forEachEntry(ObjIntConsumer<? super E> action)

Overrides default com.google.common.collect.Multiset.forEachEntry.

Runs the specified action for each distinct element in this multiset, and the number of occurrences of that element.
private int
getCount(int index)

pack-priv Multiset.Entry<E>
pack-priv ImmutableSortedMultiset<E>
getSubMultiset(int from, int to)

public ImmutableSortedMultiset<E>
headMultiset(E upperBound, BoundType boundType)

Implements abstract com.google.common.collect.ImmutableSortedMultiset.headMultiset.

Implements com.google.common.collect.SortedMultiset.headMultiset.

Returns a view of this multiset restricted to the elements less than upperBound, optionally including upperBound itself.
pack-priv boolean
isPartialView()

Implements abstract com.google.common.collect.ImmutableCollection.isPartialView.

Returns true if this immutable collection's implementation contains references to user-created objects that aren't accessible via this collection's methods.
public Multiset.Entry<E>
lastEntry()

Implements com.google.common.collect.SortedMultiset.lastEntry.

Returns the entry of the last element in this multiset, or null if this multiset is empty.
public int
size()

Implements abstract java.util.AbstractCollection.size.

Implements com.google.common.collect.Multiset.size, java.util.Collection.size.

Returns the total number of all occurrences of all elements in this multiset.
public ImmutableSortedMultiset<E>
tailMultiset(E lowerBound, BoundType boundType)

Implements abstract com.google.common.collect.ImmutableSortedMultiset.tailMultiset.

Implements com.google.common.collect.SortedMultiset.tailMultiset.

Returns a view of this multiset restricted to the elements greater than lowerBound, optionally including lowerBound itself.
pack-priv Object
Inherited from com.google.common.collect.ImmutableSortedMultiset:
buildercomparatorcopyOfcopyOfcopyOfcopyOfcopyOfcopyOfcopyOfSorteddescendingMultisetemptyMultisetnaturalOrderofofofofofofofofofofofofoforderedBypollFirstEntrypollLastEntryreverseOrdersubMultisettoImmutableMultisettoImmutableMultisettoImmutableSortedMultisettoImmutableSortedMultiset

Field Detail

cumulativeCountsback to summary
private final transient long[] cumulativeCounts
elementSetback to summary
pack-priv final transient RegularImmutableSortedSet<E> elementSet
Annotations
@VisibleForTesting
lengthback to summary
private final transient int length
NATURAL_EMPTY_MULTISETback to summary
pack-priv static final ImmutableSortedMultiset<?> NATURAL_EMPTY_MULTISET
offsetback to summary
private final transient int offset
ZERO_CUMULATIVE_COUNTSback to summary
private static final long[] ZERO_CUMULATIVE_COUNTS

Constructor Detail

RegularImmutableSortedMultisetback to summary
pack-priv RegularImmutableSortedMultiset(Comparator<? super E> comparator)
RegularImmutableSortedMultisetback to summary
pack-priv RegularImmutableSortedMultiset(RegularImmutableSortedSet<E> elementSet, long[] cumulativeCounts, int offset, int length)

Method Detail

countback to summary
public int count(Object element)

Implements com.google.common.collect.Multiset.count.

Doc from com.google.common.collect.Multiset.count.

Returns the number of occurrences of an element in this multiset (the count of the element). Note that for an Object#equals-based multiset, this gives the same result as Collections#frequency (which would presumably perform more poorly).

Note

the utility method Iterables#frequency generalizes this operation; it correctly delegates to this method when dealing with a multiset, but it can also accept any other iterable type.

Parameters
element:Object

the element to count occurrences of

Returns:int

the number of occurrences of the element in this multiset; possibly zero but never negative

Annotations
@Override
elementSetback to summary
public ImmutableSortedSet<E> elementSet()

Implements abstract com.google.common.collect.ImmutableSortedMultiset.elementSet.

Implements com.google.common.collect.SortedMultiset.elementSet, com.google.common.collect.Multiset.elementSet.

Doc from com.google.common.collect.SortedMultiset.elementSet.

Returns a NavigableSet view of the distinct elements in this multiset.

Returns:ImmutableSortedSet<E>

Doc from com.google.common.collect.Multiset.elementSet.

a view of the set of distinct elements in this multiset

Annotations
@Override
firstEntryback to summary
public Multiset.Entry<E> firstEntry()

Implements com.google.common.collect.SortedMultiset.firstEntry.

Doc from com.google.common.collect.SortedMultiset.firstEntry.

Returns the entry of the first element in this multiset, or null if this multiset is empty.

Annotations
@Override
@CheckForNull
forEachEntryback to summary
public void forEachEntry(ObjIntConsumer<? super E> action)

Overrides default com.google.common.collect.Multiset.forEachEntry.

Doc from com.google.common.collect.Multiset.forEachEntry.

Runs the specified action for each distinct element in this multiset, and the number of occurrences of that element. For some Multiset implementations, this may be more efficient than iterating over the entrySet() either explicitly or with entrySet().forEach(action).

Annotations
@Override
getCountback to summary
private int getCount(int index)
getEntryback to summary
pack-priv Multiset.Entry<E> getEntry(int index)

Implements abstract com.google.common.collect.ImmutableMultiset.getEntry.

Annotations
@Override
getSubMultisetback to summary
pack-priv ImmutableSortedMultiset<E> getSubMultiset(int from, int to)
headMultisetback to summary
public ImmutableSortedMultiset<E> headMultiset(E upperBound, BoundType boundType)

Implements abstract com.google.common.collect.ImmutableSortedMultiset.headMultiset.

Implements com.google.common.collect.SortedMultiset.headMultiset.

Doc from com.google.common.collect.SortedMultiset.headMultiset.

Returns a view of this multiset restricted to the elements less than 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.

Annotations
@Override
isPartialViewback to summary
pack-priv boolean isPartialView()

Implements abstract com.google.common.collect.ImmutableCollection.isPartialView.

Doc from com.google.common.collect.ImmutableCollection.isPartialView.

Returns 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.

Annotations
@Override
lastEntryback to summary
public Multiset.Entry<E> lastEntry()

Implements com.google.common.collect.SortedMultiset.lastEntry.

Doc from com.google.common.collect.SortedMultiset.lastEntry.

Returns the entry of the last element in this multiset, or null if this multiset is empty.

Annotations
@Override
@CheckForNull
sizeback to summary
public int size()

Implements abstract java.util.AbstractCollection.size.

Implements com.google.common.collect.Multiset.size, java.util.Collection.size.

Doc from com.google.common.collect.Multiset.size.

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 entrySet().size().

Returns:int

Doc from java.util.Collection.size.

the number of elements in this collection

Annotations
@Override
tailMultisetback to summary
public ImmutableSortedMultiset<E> tailMultiset(E lowerBound, BoundType boundType)

Implements abstract com.google.common.collect.ImmutableSortedMultiset.tailMultiset.

Implements com.google.common.collect.SortedMultiset.tailMultiset.

Doc from com.google.common.collect.SortedMultiset.tailMultiset.

Returns a view of this multiset restricted to the elements greater than 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.

Annotations
@Override
writeReplaceback to summary
pack-priv Object writeReplace()

Overrides com.google.common.collect.ImmutableSortedMultiset.writeReplace.

Annotations
@SuppressWarnings:RedundantOverride
@Override
@J2ktIncompatible