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

pack-priv abstract Class AbstractSortedMultiset<E extends @Nullable Object>

extends AbstractMultiset<E extends @Nullable Object>
implements SortedMultiset<E extends @Nullable Object>
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.TreeMultiset
Annotations
@GwtCompatible
emulated:true
@ElementTypesAreNonnullByDefault
Static Imports
com.google.common.base.Preconditions.checkNotNull

This class provides a skeletal implementation of the SortedMultiset interface.

The count and size implementations all iterate across the set returned by Multiset#entrySet(), as do many methods acting on the set returned by elementSet(). Override those methods for better performance.

Author
Louis Wasserman

Field Summary

Modifier and TypeField and Description
pack-priv final Comparator<? super E>
private transient SortedMultiset<E>

Constructor Summary

AccessConstructor and Description
pack-priv
pack-priv
AbstractSortedMultiset(Comparator<? super E> comparator)

Method Summary

Modifier and TypeMethod and Description
public 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.
pack-priv SortedMultiset<E>
pack-priv NavigableSet<E>
createElementSet()

Overrides com.google.common.collect.AbstractMultiset.createElementSet.

Creates a new instance of this multiset's element set, which will be returned by elementSet().
pack-priv abstract Iterator<Multiset.Entry<E>>
pack-priv Iterator<E>
public SortedMultiset<E>
descendingMultiset()

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

Returns a descending view of this multiset.
public NavigableSet<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 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 Multiset.Entry<E>
pollFirstEntry()

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

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

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

Returns and removes the entry associated with the greatest element in this multiset, or returns null if this multiset is empty.
public SortedMultiset<E>
subMultiset(E fromElement, BoundType fromBoundType, E toElement, BoundType toBoundType)

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

Returns a view of this multiset restricted to the range between lowerBound and upperBound.
Inherited from com.google.common.collect.AbstractMultiset:
addaddaddAllclearcontainscreateEntrySetdistinctElementselementIteratorentryIteratorentrySetequalshashCodeisEmptyremoveremoveremoveAllretainAllsetCountsetCounttoString

Field Detail

comparatorback to summary
pack-priv final Comparator<? super E> comparator
Annotations
@GwtTransient
descendingMultisetback to summary
private transient SortedMultiset<E> descendingMultiset
Annotations
@LazyInit
@CheckForNull

Constructor Detail

AbstractSortedMultisetback to summary
pack-priv AbstractSortedMultiset()
Annotations
@SuppressWarnings:unchecked
AbstractSortedMultisetback to summary
pack-priv AbstractSortedMultiset(Comparator<? super E> comparator)

Method Detail

comparatorback to summary
public 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
createDescendingMultisetback to summary
pack-priv SortedMultiset<E> createDescendingMultiset()
createElementSetback to summary
pack-priv NavigableSet<E> createElementSet()

Overrides com.google.common.collect.AbstractMultiset.createElementSet.

Doc from com.google.common.collect.AbstractMultiset.createElementSet.

Creates a new instance of this multiset's element set, which will be returned by elementSet().

Annotations
@Override
descendingEntryIteratorback to summary
pack-priv abstract Iterator<Multiset.Entry<E>> descendingEntryIterator()
descendingIteratorback to summary
pack-priv Iterator<E> descendingIterator()
descendingMultisetback to summary
public SortedMultiset<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 NavigableSet<E> elementSet()

Overrides com.google.common.collect.AbstractMultiset.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:NavigableSet<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
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
pollFirstEntryback to summary
public Multiset.Entry<E> pollFirstEntry()

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

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

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

Annotations
@Override
@CheckForNull
pollLastEntryback to summary
public Multiset.Entry<E> pollLastEntry()

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

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

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

Annotations
@Override
@CheckForNull
subMultisetback to summary
public SortedMultiset<E> subMultiset(E fromElement, BoundType fromBoundType, E toElement, BoundType toBoundType)

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