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

public abstract Class ImmutableSortedMultiset<E>

extends ImmutableMultiset<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>
private static final long

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public static <E> ImmutableSortedMultiset.Builder<E>
builder()

Hides com.google.common.collect.ImmutableMultiset.builder.

Deprecated Use ImmutableSortedMultiset#naturalOrder, which offers better type-safety.
Not supported.
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.ImmutableMultiset.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 <Z> ImmutableSortedMultiset<Z>
copyOf(Z[] elements)

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

Deprecated Pass parameters of type Comparable to use ImmutableSortedMultiset#copyOf(Comparable[]).
Not supported.
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.ImmutableMultiset.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.ImmutableMultiset.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.ImmutableMultiset.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.ImmutableMultiset.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.ImmutableMultiset.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.ImmutableMultiset.of.

Returns an immutable sorted multiset containing the given elements sorted by their natural ordering.
public static <E> ImmutableSortedMultiset<E>
of(E element)

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

Deprecated Pass a parameter of type Comparable to use ImmutableSortedMultiset#of(Comparable).
Not supported.
public static <E> ImmutableSortedMultiset<E>
of(E e1, E e2)

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

Deprecated Pass the parameters of type Comparable to use ImmutableSortedMultiset#of(Comparable, Comparable).
Not supported.
public static <E> ImmutableSortedMultiset<E>
of(E e1, E e2, E e3)

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

Deprecated Pass the parameters of type Comparable to use ImmutableSortedMultiset#of(Comparable, Comparable, Comparable).
Not supported.
public static <E> ImmutableSortedMultiset<E>
of(E e1, E e2, E e3, E e4)

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

Deprecated Pass the parameters of type Comparable to use ImmutableSortedMultiset#of(Comparable, Comparable, Comparable, Comparable).
Not supported.
public static <E> ImmutableSortedMultiset<E>
of(E e1, E e2, E e3, E e4, E e5)

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

Deprecated Pass the parameters of type Comparable to use ImmutableSortedMultiset#of(Comparable, Comparable, Comparable, Comparable, Comparable) .
Not supported.
public static <E> ImmutableSortedMultiset<E>
of(E e1, E e2, E e3, E e4, E e5, E e6, E... remaining)

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

Not supported.
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, ?, ImmutableMultiset<E>>
public static <T extends @Nullable Object, E> Collector<T, ?, ImmutableMultiset<E>>
toImmutableMultiset(Function<? super T, ? extends E> elementFunction, ToIntFunction<? super T> countFunction)

Hides com.google.common.collect.ImmutableMultiset.toImmutableMultiset.

Not supported.
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.ImmutableMultiset:
addasListcontainscopyFromEntriescopyIntoArrayentrySetequalsgetEntryhashCodeiteratorremovesetCountsetCounttoString