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

public abstract Class ImmutableSortedMultiset<E>

extends ImmutableSortedMultisetFauxverideShim<E>
implements SortedMultiset<E>
Class Inheritance
All Implemented Interfaces
com.google.common.collect.SortedMultiset, com.google.common.collect.SortedIterable, java.lang.Iterable, com.google.common.collect.SortedMultisetBridge, com.google.common.collect.Multiset, java.util.Collection
Known Direct Subclasses
com.google.common.collect.RegularImmutableSortedMultiset, com.google.common.collect.DescendingImmutableSortedMultiset
Annotations
@GwtIncompatible
@ElementTypesAreNonnullByDefault
Static Imports
com.google.common.base.Preconditions.checkArgument, .Preconditions.checkNotNull

A SortedMultiset whose contents will never change, with many other important properties detailed at ImmutableCollection.

Warning

as with any sorted collection, you are strongly advised not to use a Comparator or Comparable type whose comparison behavior is inconsistent with equals. That is, a.compareTo(b) or comparator.compare(a, b) should equal zero if and only if a.equals(b). If this advice is not followed, the resulting collection will not correctly obey its specification.

See the Guava User Guide article on immutable collections.

Author
Louis Wasserman
Since
12.0

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
ImmutableSortedMultiset.Builder<E>

A builder for creating immutable multiset instances, especially public static final multisets ("constant multisets").

private static class

Field Summary

Modifier and TypeField and Description
pack-priv transient ImmutableSortedMultiset<E>

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public final Comparator<? super E>
comparator()

Implements com.google.common.collect.SortedMultiset.comparator.

Returns the comparator that orders this multiset, or Ordering#natural() if the natural ordering of the elements is used.
public static <E extends Comparable<? super E>> ImmutableSortedMultiset<E>
copyOf(E[] elements)

Hides com.google.common.collect.ImmutableSortedMultisetFauxverideShim.copyOf.

Returns an immutable sorted multiset containing the given elements sorted by their natural ordering.
public static <E> ImmutableSortedMultiset<E>
copyOf(Iterable<? extends E> elements)

Hides com.google.common.collect.ImmutableMultiset.copyOf.

Returns an immutable sorted multiset containing the given elements sorted by their natural ordering.
public static <E> ImmutableSortedMultiset<E>
copyOf(Iterator<? extends E> elements)

Hides com.google.common.collect.ImmutableMultiset.copyOf.

Returns an immutable sorted multiset containing the given elements sorted by their natural ordering.
public static <E> ImmutableSortedMultiset<E>
copyOf(Comparator<? super E> comparator, Iterator<? extends E> elements)

Returns an immutable sorted multiset containing the given elements sorted by the given Comparator.

public static <E> ImmutableSortedMultiset<E>
copyOf(Comparator<? super E> comparator, Iterable<? extends E> elements)

Returns an immutable sorted multiset containing the given elements sorted by the given Comparator.

public static <E> ImmutableSortedMultiset<E>
copyOfSorted(SortedMultiset<E> sortedMultiset)

Returns an immutable sorted multiset containing the elements of a sorted multiset, sorted by the same Comparator.

private static <E> ImmutableSortedMultiset<E>
copyOfSortedEntries(Comparator<? super E> comparator, Collection<Multiset.Entry<E>> entries)

public ImmutableSortedMultiset<E>
descendingMultiset()

Implements com.google.common.collect.SortedMultiset.descendingMultiset.

Returns a descending view of this multiset.
public abstract ImmutableSortedSet<E>
pack-priv static <E> ImmutableSortedMultiset<E>
emptyMultiset(Comparator<? super E> comparator)

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

Redeclares com.google.common.collect.SortedMultiset.headMultiset.

Returns a view of this multiset restricted to the elements less than upperBound, optionally including upperBound itself.
public static <E extends Comparable<?>> ImmutableSortedMultiset.Builder<E>
naturalOrder()

Returns a builder that creates immutable sorted multisets whose elements are ordered by their natural ordering.

public static <E> ImmutableSortedMultiset<E>
of()

Hides com.google.common.collect.ImmutableMultiset.of.

Returns the empty immutable sorted multiset.
public static <E extends Comparable<? super E>> ImmutableSortedMultiset<E>
of(E element)

Hides com.google.common.collect.ImmutableSortedMultisetFauxverideShim.of.

Returns an immutable sorted multiset containing a single element.
public static <E extends Comparable<? super E>> ImmutableSortedMultiset<E>
of(E e1, E e2)

Hides com.google.common.collect.ImmutableSortedMultisetFauxverideShim.of.

Returns an immutable sorted multiset containing the given elements sorted by their natural ordering.
public static <E extends Comparable<? super E>> ImmutableSortedMultiset<E>
of(E e1, E e2, E e3)

Hides com.google.common.collect.ImmutableSortedMultisetFauxverideShim.of.

Returns an immutable sorted multiset containing the given elements sorted by their natural ordering.
public static <E extends Comparable<? super E>> ImmutableSortedMultiset<E>
of(E e1, E e2, E e3, E e4)

Hides com.google.common.collect.ImmutableSortedMultisetFauxverideShim.of.

Returns an immutable sorted multiset containing the given elements sorted by their natural ordering.
public static <E extends Comparable<? super E>> ImmutableSortedMultiset<E>
of(E e1, E e2, E e3, E e4, E e5)

Hides com.google.common.collect.ImmutableSortedMultisetFauxverideShim.of.

Returns an immutable sorted multiset containing the given elements sorted by their natural ordering.
public static <E extends Comparable<? super E>> ImmutableSortedMultiset<E>
of(E e1, E e2, E e3, E e4, E e5, E e6, E... remaining)

Hides com.google.common.collect.ImmutableSortedMultisetFauxverideShim.of.

Returns an immutable sorted multiset containing the given elements sorted by their natural ordering.
public static <E> ImmutableSortedMultiset.Builder<E>
orderedBy(Comparator<E> comparator)

Returns a builder that creates immutable sorted multisets with an explicit comparator.

public final Multiset.Entry<E>
pollFirstEntry()

Implements com.google.common.collect.SortedMultiset.pollFirstEntry.

Deprecated Unsupported operation.
Returns and removes the entry associated with the lowest element in this multiset, or returns null if this multiset is empty.
public final Multiset.Entry<E>
pollLastEntry()

Implements com.google.common.collect.SortedMultiset.pollLastEntry.

Deprecated Unsupported operation.
Returns and removes the entry associated with the greatest element in this multiset, or returns null if this multiset is empty.
private void
public static <E extends Comparable<?>> ImmutableSortedMultiset.Builder<E>
reverseOrder()

Returns a builder that creates immutable sorted multisets whose elements are ordered by the reverse of their natural ordering.

public ImmutableSortedMultiset<E>
subMultiset(E lowerBound, BoundType lowerBoundType, E upperBound, BoundType upperBoundType)

Implements com.google.common.collect.SortedMultiset.subMultiset.

Returns a view of this multiset restricted to the range between lowerBound and upperBound.
public abstract ImmutableSortedMultiset<E>
tailMultiset(E lowerBound, BoundType boundType)

Redeclares com.google.common.collect.SortedMultiset.tailMultiset.

Returns a view of this multiset restricted to the elements greater than lowerBound, optionally including lowerBound itself.
public static <E> Collector<E, ?, ImmutableSortedMultiset<E>>
toImmutableSortedMultiset(Comparator<? super E> comparator)

Returns a Collector that accumulates the input elements into a new ImmutableMultiset.

public static <T extends @Nullable Object, E> Collector<T, ?, ImmutableSortedMultiset<E>>
toImmutableSortedMultiset(Comparator<? super E> comparator, Function<? super T, ? extends E> elementFunction, ToIntFunction<? super T> countFunction)

Returns a Collector that accumulates elements into an ImmutableSortedMultiset whose elements are the result of applying elementFunction to the inputs, with counts equal to the result of applying countFunction to the inputs.

pack-priv Object
Inherited from com.google.common.collect.ImmutableSortedMultisetFauxverideShim:
buildertoImmutableMultisettoImmutableMultiset

Field Detail

descendingMultisetback to summary
pack-priv transient ImmutableSortedMultiset<E> descendingMultiset
Annotations
@LazyInit
@CheckForNull

Constructor Detail

ImmutableSortedMultisetback to summary
pack-priv ImmutableSortedMultiset()

Method Detail

comparatorback to summary
public final Comparator<? super E> comparator()

Implements com.google.common.collect.SortedMultiset.comparator.

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

Returns the comparator that orders this multiset, or Ordering#natural() if the natural ordering of the elements is used.

Annotations
@Override
copyOfback to summary
public static <E extends Comparable<? super E>> ImmutableSortedMultiset<E> copyOf(E[] elements)

Hides com.google.common.collect.ImmutableSortedMultisetFauxverideShim.copyOf.

Returns an immutable sorted multiset containing the given elements sorted by their natural ordering.

Exceptions
NullPointerException:
if any of elements is null
copyOfback to summary
public static <E> ImmutableSortedMultiset<E> copyOf(Iterable<? extends E> elements)

Hides com.google.common.collect.ImmutableMultiset.copyOf.

Returns an immutable sorted multiset containing the given elements sorted by their natural ordering. To create a copy of a SortedMultiset that preserves the comparator, call copyOfSorted instead. This method iterates over elements at most once.

Note that if s is a Multiset<String>, then ImmutableSortedMultiset.copyOf(s) returns an ImmutableSortedMultiset<String> containing each of the strings in s, while ImmutableSortedMultiset.of(s) returns an ImmutableSortedMultiset<Multiset<String>> containing one element (the given multiset itself).

Despite the method name, this method attempts to avoid actually copying the data when it is safe to do so. The exact circumstances under which a copy will or will not be performed are undocumented and subject to change.

This method is not type-safe, as it may be called on elements that are not mutually comparable.

Exceptions
ClassCastException:
if the elements are not mutually comparable
NullPointerException:
if any of elements is null
copyOfback to summary
public static <E> ImmutableSortedMultiset<E> copyOf(Iterator<? extends E> elements)

Hides com.google.common.collect.ImmutableMultiset.copyOf.

Returns an immutable sorted multiset containing the given elements sorted by their natural ordering.

This method is not type-safe, as it may be called on elements that are not mutually comparable.

Exceptions
ClassCastException:
if the elements are not mutually comparable
NullPointerException:
if any of elements is null
copyOfback to summary
public static <E> ImmutableSortedMultiset<E> copyOf(Comparator<? super E> comparator, Iterator<? extends E> elements)

Returns an immutable sorted multiset containing the given elements sorted by the given Comparator.

Exceptions
NullPointerException:
if comparator or any of elements is null
copyOfback to summary
public static <E> ImmutableSortedMultiset<E> copyOf(Comparator<? super E> comparator, Iterable<? extends E> elements)

Returns an immutable sorted multiset containing the given elements sorted by the given Comparator. This method iterates over elements at most once.

Despite the method name, this method attempts to avoid actually copying the data when it is safe to do so. The exact circumstances under which a copy will or will not be performed are undocumented and subject to change.

Exceptions
NullPointerException:
if comparator or any of elements is null
copyOfSortedback to summary
public static <E> ImmutableSortedMultiset<E> copyOfSorted(SortedMultiset<E> sortedMultiset)

Returns an immutable sorted multiset containing the elements of a sorted multiset, sorted by the same Comparator. That behavior differs from copyOf(Iterable), which always uses the natural ordering of the elements.

Despite the method name, this method attempts to avoid actually copying the data when it is safe to do so. The exact circumstances under which a copy will or will not be performed are undocumented and subject to change.

This method is safe to use even when sortedMultiset is a synchronized or concurrent collection that is currently being modified by another thread.

Exceptions
NullPointerException:
if sortedMultiset or any of its elements is null
copyOfSortedEntriesback to summary
private static <E> ImmutableSortedMultiset<E> copyOfSortedEntries(Comparator<? super E> comparator, Collection<Multiset.Entry<E>> entries)
descendingMultisetback to summary
public ImmutableSortedMultiset<E> descendingMultiset()

Implements com.google.common.collect.SortedMultiset.descendingMultiset.

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

Returns a descending view of this multiset. Modifications made to either map will be reflected in the other.

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

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

Implements abstract com.google.common.collect.ImmutableMultiset.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
emptyMultisetback to summary
pack-priv static <E> ImmutableSortedMultiset<E> emptyMultiset(Comparator<? super E> comparator)
Annotations
@SuppressWarnings:unchecked
headMultisetback to summary
public abstract ImmutableSortedMultiset<E> headMultiset(E upperBound, BoundType boundType)

Redeclares 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
naturalOrderback to summary
public static <E extends Comparable<?>> ImmutableSortedMultiset.Builder<E> naturalOrder()

Returns a builder that creates immutable sorted multisets whose elements are ordered by their natural ordering. The sorted multisets use Ordering#natural() as the comparator. This method provides more type-safety than builder, as it can be called only for classes that implement Comparable.

Note

the type parameter E extends Comparable<?> rather than Comparable<? super E> as a workaround for javac bug 6468354.

ofback to summary
public static <E> ImmutableSortedMultiset<E> of()

Hides com.google.common.collect.ImmutableMultiset.of.

Returns the empty immutable sorted multiset.

Performance note: the instance returned is a singleton.

Annotations
@SuppressWarnings:unchecked
ofback to summary
public static <E extends Comparable<? super E>> ImmutableSortedMultiset<E> of(E element)

Hides com.google.common.collect.ImmutableSortedMultisetFauxverideShim.of.

Returns an immutable sorted multiset containing a single element.

ofback to summary
public static <E extends Comparable<? super E>> ImmutableSortedMultiset<E> of(E e1, E e2)

Hides com.google.common.collect.ImmutableSortedMultisetFauxverideShim.of.

Returns an immutable sorted multiset containing the given elements sorted by their natural ordering.

Exceptions
NullPointerException:
if any element is null
ofback to summary
public static <E extends Comparable<? super E>> ImmutableSortedMultiset<E> of(E e1, E e2, E e3)

Hides com.google.common.collect.ImmutableSortedMultisetFauxverideShim.of.

Returns an immutable sorted multiset containing the given elements sorted by their natural ordering.

Exceptions
NullPointerException:
if any element is null
ofback to summary
public static <E extends Comparable<? super E>> ImmutableSortedMultiset<E> of(E e1, E e2, E e3, E e4)

Hides com.google.common.collect.ImmutableSortedMultisetFauxverideShim.of.

Returns an immutable sorted multiset containing the given elements sorted by their natural ordering.

Exceptions
NullPointerException:
if any element is null
ofback to summary
public static <E extends Comparable<? super E>> ImmutableSortedMultiset<E> of(E e1, E e2, E e3, E e4, E e5)

Hides com.google.common.collect.ImmutableSortedMultisetFauxverideShim.of.

Returns an immutable sorted multiset containing the given elements sorted by their natural ordering.

Exceptions
NullPointerException:
if any element is null
ofback to summary
public static <E extends Comparable<? super E>> ImmutableSortedMultiset<E> of(E e1, E e2, E e3, E e4, E e5, E e6, E... remaining)

Hides com.google.common.collect.ImmutableSortedMultisetFauxverideShim.of.

Returns an immutable sorted multiset containing the given elements sorted by their natural ordering.

Exceptions
NullPointerException:
if any element is null
orderedByback to summary
public static <E> ImmutableSortedMultiset.Builder<E> orderedBy(Comparator<E> comparator)

Returns a builder that creates immutable sorted multisets with an explicit comparator. If the comparator has a more general type than the set being generated, such as creating a SortedMultiset<Integer> with a Comparator<Number>, use the Builder constructor instead.

Exceptions
NullPointerException:
if comparator is null
pollFirstEntryback to summary
public final Multiset.Entry<E> pollFirstEntry()

Implements com.google.common.collect.SortedMultiset.pollFirstEntry.

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

Deprecated

Unsupported operation.

Returns and removes the entry associated with the lowest element in this multiset, or returns null if this multiset is empty.

This implementation is guaranteed to throw an UnsupportedOperationException.

Annotations
@CanIgnoreReturnValue
@Deprecated
@Override
@DoNotCall:Always throws UnsupportedOperationException
@CheckForNull
Exceptions
UnsupportedOperationException:
always
pollLastEntryback to summary
public final Multiset.Entry<E> pollLastEntry()

Implements com.google.common.collect.SortedMultiset.pollLastEntry.

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

Deprecated

Unsupported operation.

Returns and removes the entry associated with the greatest element in this multiset, or returns null if this multiset is empty.

This implementation is guaranteed to throw an UnsupportedOperationException.

Annotations
@CanIgnoreReturnValue
@Deprecated
@Override
@DoNotCall:Always throws UnsupportedOperationException
@CheckForNull
Exceptions
UnsupportedOperationException:
always
readObjectback to summary
private void readObject(ObjectInputStream stream) throws InvalidObjectException

Hides com.google.common.collect.ImmutableMultiset.readObject.

Annotations
@J2ktIncompatible
reverseOrderback to summary
public static <E extends Comparable<?>> ImmutableSortedMultiset.Builder<E> reverseOrder()

Returns a builder that creates immutable sorted multisets whose elements are ordered by the reverse of their natural ordering.

Note

the type parameter E extends Comparable<?> rather than Comparable<? super E> as a workaround for javac bug 6468354.

subMultisetback to summary
public ImmutableSortedMultiset<E> subMultiset(E lowerBound, BoundType lowerBoundType, E upperBound, BoundType upperBoundType)

Implements com.google.common.collect.SortedMultiset.subMultiset.

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

Returns a view of this multiset restricted to the range between lowerBound and upperBound. 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.

This method is equivalent to tailMultiset(lowerBound, lowerBoundType).headMultiset(upperBound, upperBoundType).

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

Redeclares 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
toImmutableSortedMultisetback to summary
public static <E> Collector<E, ?, ImmutableSortedMultiset<E>> toImmutableSortedMultiset(Comparator<? super E> comparator)

Returns a Collector that accumulates the input elements into a new ImmutableMultiset. Elements are sorted by the specified comparator.

Warning

comparator should be consistent with equals as explained in the Comparator documentation.

Since
21.0
toImmutableSortedMultisetback to summary
public static <T extends @Nullable Object, E> Collector<T, ?, ImmutableSortedMultiset<E>> toImmutableSortedMultiset(Comparator<? super E> comparator, Function<? super T, ? extends E> elementFunction, ToIntFunction<? super T> countFunction)

Returns a Collector that accumulates elements into an ImmutableSortedMultiset whose elements are the result of applying elementFunction to the inputs, with counts equal to the result of applying countFunction to the inputs.

If the mapped elements contain duplicates (according to comparator), the first occurrence in encounter order appears in the resulting multiset, with count equal to the sum of the outputs of countFunction.applyAsInt(t) for each t mapped to that element.

Since
22.0
writeReplaceback to summary
pack-priv Object writeReplace()

Overrides com.google.common.collect.ImmutableMultiset.writeReplace.

Annotations
@Override
@J2ktIncompatible
com.google.common.collect back to summary

public Class ImmutableSortedMultiset.Builder<E>

extends ImmutableMultiset.Builder<E>
Class Inheritance

A builder for creating immutable multiset instances, especially public static final multisets ("constant multisets"). Example:
public static final ImmutableSortedMultiset<Bean> BEANS =
    new ImmutableSortedMultiset.Builder<Bean>(colorComparator())
        .addCopies(Bean.COCOA, 4)
        .addCopies(Bean.GARDEN, 6)
        .addCopies(Bean.RED, 8)
        .addCopies(Bean.BLACK_EYED, 10)
        .build();

Builder instances can be reused; it is safe to call build multiple times to build multiple multisets in series.

Since
12.0

Field Summary

Inherited from com.google.common.collect.ImmutableMultiset.Builder:
contents

Constructor Summary

AccessConstructor and Description
public
Builder(Comparator<? super E> comparator)

Creates a new builder.

Method Summary

Modifier and TypeMethod and Description
public ImmutableSortedMultiset.Builder<E>

Returns:

this Builder object
add
(E
the element to add
element
)

Overrides com.google.common.collect.ImmutableMultiset.Builder.add.

Adds element to the ImmutableSortedMultiset.
public ImmutableSortedMultiset.Builder<E>

Returns:

this Builder object
add
(E...
the elements to add
elements
)

Overrides com.google.common.collect.ImmutableMultiset.Builder.add, com.google.common.collect.ImmutableMultiset.Builder.add.

Adds each element of elements to the ImmutableSortedMultiset.
public ImmutableSortedMultiset.Builder<E>

Returns:

this Builder object
addAll
(Iterable<? extends E>
the Iterable to add to the ImmutableSortedMultiset
elements
)

Overrides com.google.common.collect.ImmutableMultiset.Builder.addAll.

Adds each element of elements to the ImmutableSortedMultiset.
public ImmutableSortedMultiset.Builder<E>

Returns:

this Builder object
addAll
(Iterator<? extends E>
the elements to add to the ImmutableSortedMultiset
elements
)

Overrides com.google.common.collect.ImmutableMultiset.Builder.addAll.

Adds each element of elements to the ImmutableSortedMultiset.
public ImmutableSortedMultiset.Builder<E>

Returns:

this Builder object
addCopies
(E
the element to add
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.google.common.collect.ImmutableMultiset.Builder.addCopies.

Adds a number of occurrences of an element to this ImmutableSortedMultiset.
public ImmutableSortedMultiset<E>
build()

Overrides com.google.common.collect.ImmutableMultiset.Builder.build.

Returns a newly-created ImmutableSortedMultiset based on the contents of the Builder.
public ImmutableSortedMultiset.Builder<E>

Returns:

this Builder object
setCount
(E
the element to add or remove occurrences of
element
,
int
the desired count of the element in this multiset
count
)

Overrides com.google.common.collect.ImmutableMultiset.Builder.setCount.

Adds or removes the necessary occurrences of an element such that the element attains the desired count.
Inherited from com.google.common.collect.ImmutableMultiset.Builder:
buildJdkBacked

Constructor Detail

Builderback to summary
public Builder(Comparator<? super E> comparator)

Creates a new builder. The returned builder is equivalent to the builder generated by ImmutableSortedMultiset#orderedBy(Comparator).

Method Detail

addback to summary
public ImmutableSortedMultiset.Builder<E> add(E element)

Overrides com.google.common.collect.ImmutableMultiset.Builder.add.

Adds element to the ImmutableSortedMultiset.

Parameters
element:E

the element to add

Returns:ImmutableSortedMultiset.Builder<E>

this Builder object

Annotations
@CanIgnoreReturnValue
@Override
Exceptions
NullPointerException:
if element is null
addback to summary
public ImmutableSortedMultiset.Builder<E> add(E... elements)

Overrides com.google.common.collect.ImmutableMultiset.Builder.add, com.google.common.collect.ImmutableMultiset.Builder.add.

Adds each element of elements to the ImmutableSortedMultiset.

Parameters
elements:E[]

the elements to add

Returns:ImmutableSortedMultiset.Builder<E>

this Builder object

Annotations
@CanIgnoreReturnValue
@Override
Exceptions
NullPointerException:
if elements is null or contains a null element
addAllback to summary
public ImmutableSortedMultiset.Builder<E> addAll(Iterable<? extends E> elements)

Overrides com.google.common.collect.ImmutableMultiset.Builder.addAll.

Adds each element of elements to the ImmutableSortedMultiset.

Parameters
elements:Iterable<? extends E>

the Iterable to add to the ImmutableSortedMultiset

Returns:ImmutableSortedMultiset.Builder<E>

this Builder object

Annotations
@CanIgnoreReturnValue
@Override
Exceptions
NullPointerException:
if elements is null or contains a null element
addAllback to summary
public ImmutableSortedMultiset.Builder<E> addAll(Iterator<? extends E> elements)

Overrides com.google.common.collect.ImmutableMultiset.Builder.addAll.

Adds each element of elements to the ImmutableSortedMultiset.

Parameters
elements:Iterator<? extends E>

the elements to add to the ImmutableSortedMultiset

Returns:ImmutableSortedMultiset.Builder<E>

this Builder object

Annotations
@CanIgnoreReturnValue
@Override
Exceptions
NullPointerException:
if elements is null or contains a null element
addCopiesback to summary
public ImmutableSortedMultiset.Builder<E> addCopies(E element, int occurrences)

Overrides com.google.common.collect.ImmutableMultiset.Builder.addCopies.

Adds a number of occurrences of an element to this ImmutableSortedMultiset.

Parameters
element:E

the element to add

occurrences:int

the number of occurrences of the element to add. May be zero, in which case no change will be made.

Returns:ImmutableSortedMultiset.Builder<E>

this Builder object

Annotations
@CanIgnoreReturnValue
@Override
Exceptions
NullPointerException:
if element is null
IllegalArgumentException:
if occurrences is negative, or if this operation would result in more than Integer#MAX_VALUE occurrences of the element
buildback to summary
public ImmutableSortedMultiset<E> build()

Overrides com.google.common.collect.ImmutableMultiset.Builder.build.

Returns a newly-created ImmutableSortedMultiset based on the contents of the Builder.

Annotations
@Override
setCountback to summary
public ImmutableSortedMultiset.Builder<E> setCount(E element, int count)

Overrides com.google.common.collect.ImmutableMultiset.Builder.setCount.

Adds or removes the necessary occurrences of an element such that the element attains the desired count.

Parameters
element:E

the element to add or remove occurrences of

count:int

the desired count of the element in this multiset

Returns:ImmutableSortedMultiset.Builder<E>

this Builder object

Annotations
@CanIgnoreReturnValue
@Override
Exceptions
NullPointerException:
if element is null
IllegalArgumentException:
if count is negative
com.google.common.collect back to summary

private final Class ImmutableSortedMultiset.SerializedForm<E>

extends Object
implements Serializable
Class Inheritance
  • java.lang.Object
  • com.google.common.collect.ImmutableSortedMultiset.SerializedForm
All Implemented Interfaces
java.io.Serializable
Annotations
@J2ktIncompatible

Field Summary

Modifier and TypeField and Description
pack-priv final Comparator<? super E>
pack-priv final int[]
pack-priv final E[]

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv Object
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

comparatorback to summary
pack-priv final Comparator<? super E> comparator
countsback to summary
pack-priv final int[] counts
elementsback to summary
pack-priv final E[] elements

Constructor Detail

SerializedFormback to summary
pack-priv SerializedForm(SortedMultiset<E> multiset)
Annotations
@SuppressWarnings:unchecked

Method Detail

readResolveback to summary
pack-priv Object readResolve()