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

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

extends ForwardingMultiset<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.ForwardingSortedMultiset.StandardDescendingMultiset
Annotations
@GwtCompatible
emulated:true
@ElementTypesAreNonnullByDefault
Imports
com.google.common.annotations.GwtCompatible, com.google.errorprone.annotations.concurrent.LazyInit, com.google.j2objc.annotations.WeakOuter, java.util.Comparator, .Iterator, .NavigableSet, .Set, javax.annotation.CheckForNull, org.checkerframework.checker.nullness.qual.Nullable

A skeleton implementation of a descending multiset. Only needs forwardMultiset() and entryIterator().
Author
Louis Wasserman

Field Summary

Modifier and TypeField and Description
private transient Comparator<? super E>
private transient NavigableSet<E>
private transient Set<Multiset.Entry<E>>

Constructor Summary

AccessConstructor and Description
pack-priv

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 Set<Multiset.Entry<E>>
protected Multiset<E>
delegate()

Implements abstract com.google.common.collect.ForwardingMultiset.delegate.

Returns the backing delegate instance that methods are forwarded to.
public SortedMultiset<E>
descendingMultiset()

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

Returns a descending view of this multiset.
public NavigableSet<E>
pack-priv abstract Iterator<Multiset.Entry<E>>
public Set<Multiset.Entry<E>>
entrySet()

Overrides com.google.common.collect.ForwardingMultiset.entrySet.

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

Returns a view of the contents of this multiset, grouped into Multiset.Entry instances, each providing an element of the multiset and the count of that element.
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.
pack-priv abstract SortedMultiset<E>
public SortedMultiset<E>
headMultiset(E toElement, BoundType boundType)

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

Returns a view of this multiset restricted to the elements less than upperBound, optionally including upperBound itself.
public Iterator<E>
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.
public SortedMultiset<E>
tailMultiset(E fromElement, BoundType boundType)

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

Returns a view of this multiset restricted to the elements greater than lowerBound, optionally including lowerBound itself.
public @Nullable Object[]
toArray()

Overrides com.google.common.collect.ForwardingCollection.toArray.

Implements java.util.Collection.toArray.

Returns an array containing all of the elements in this collection.
public <T extends @Nullable Object> T[]
toArray(T[]
the array into which the elements of this collection are to be stored, if it is big enough; otherwise, a new array of the same runtime type is allocated for this purpose.
array
)

Overrides com.google.common.collect.ForwardingCollection.toArray.

Implements java.util.Collection.toArray.

Returns an array containing all of the elements in this collection; the runtime type of the returned array is that of the specified array.
public String
toString()

Overrides com.google.common.collect.ForwardingObject.toString.

Implements com.google.common.collect.Multiset.toString.

It is recommended, though not mandatory, that this method return the result of invoking toString on the entrySet, yielding a result such as [a x 3, c, d x 2, e].

Inherited from com.google.common.collect.ForwardingMultiset:
addcountequalshashCoderemovesetCountsetCountstandardAddstandardAddAllstandardClearstandardContainsstandardCountstandardEqualsstandardHashCodestandardIteratorstandardRemovestandardRemoveAllstandardRetainAllstandardSetCountstandardSetCountstandardSizestandardToString

Field Detail

comparatorback to summary
private transient Comparator<? super E> comparator
Annotations
@LazyInit
@CheckForNull
elementSetback to summary
private transient NavigableSet<E> elementSet
Annotations
@LazyInit
@CheckForNull
entrySetback to summary
private transient Set<Multiset.Entry<E>> entrySet
Annotations
@LazyInit
@CheckForNull

Constructor Detail

DescendingMultisetback to summary
pack-priv DescendingMultiset()

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
createEntrySetback to summary
pack-priv Set<Multiset.Entry<E>> createEntrySet()
delegateback to summary
protected Multiset<E> delegate()

Implements abstract com.google.common.collect.ForwardingMultiset.delegate.

Doc from com.google.common.collect.ForwardingObject.delegate.

Returns the backing delegate instance that methods are forwarded to. Abstract subclasses generally override this method with an abstract method that has a more specific return type, such as ForwardingSet#delegate. Concrete subclasses override this method to supply the instance being decorated.

Annotations
@Override
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.ForwardingMultiset.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
entryIteratorback to summary
pack-priv abstract Iterator<Multiset.Entry<E>> entryIterator()
entrySetback to summary
public Set<Multiset.Entry<E>> entrySet()

Overrides com.google.common.collect.ForwardingMultiset.entrySet.

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

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

Returns a view of the contents of this multiset, grouped into Multiset.Entry instances, each providing an element of the multiset and the count of that element. This set contains exactly one entry for each distinct element in the multiset (thus it always has the same size as the elementSet). The order of the elements in the element set is unspecified.

The entry set is backed by the same data as the multiset, so any change to either is immediately reflected in the other. However, multiset changes may or may not be reflected in any Entry instances already retrieved from the entry set (this is implementation-dependent). Furthermore, implementations are not required to support modifications to the entry set at all, and the Entry instances themselves don't even have methods for modification. See the specific implementation class for more details on how its entry set handles modifications.

The entrySet's iterator returns entries in ascending element order according to this multiset's comparator.

Returns:Set<Multiset.Entry<E>>

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

a set of entries representing the data of 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
forwardMultisetback to summary
pack-priv abstract SortedMultiset<E> forwardMultiset()
headMultisetback to summary
public SortedMultiset<E> headMultiset(E toElement, BoundType boundType)

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
iteratorback to summary
public Iterator<E> iterator()

Overrides com.google.common.collect.ForwardingCollection.iterator.

Implements com.google.common.collect.SortedMultiset.iterator, com.google.common.collect.Multiset.iterator, java.util.Collection.iterator.

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

Returns an iterator over elements of type T. The elements are returned in nondecreasing order according to the associated comparator.

The iterator returns the elements in ascending order according to this multiset's comparator.

Returns:Iterator<E>

Doc from java.util.Collection.iterator.

an Iterator over the elements in this collection

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
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
tailMultisetback to summary
public SortedMultiset<E> tailMultiset(E fromElement, BoundType boundType)

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
toArrayback to summary
public @Nullable Object[] toArray()

Overrides com.google.common.collect.ForwardingCollection.toArray.

Implements java.util.Collection.toArray.

Doc from java.util.Collection.toArray.

Returns an array containing all of the elements in this collection. If this collection makes any guarantees as to what order its elements are returned by its iterator, this method must return the elements in the same order. The returned array's runtime component type is Object.

The returned array will be "safe" in that no references to it are maintained by this collection. (In other words, this method must allocate a new array even if this collection is backed by an array). The caller is thus free to modify the returned array.

Returns:@Nullable Object[]

an array, whose runtime component type is Object, containing all of the elements in this collection

Annotations
@Override
toArrayback to summary
public <T extends @Nullable Object> T[] toArray(T[] array)

Overrides com.google.common.collect.ForwardingCollection.toArray.

Implements java.util.Collection.toArray.

Doc from java.util.Collection.toArray.

Returns an array containing all of the elements in this collection; the runtime type of the returned array is that of the specified array. If the collection fits in the specified array, it is returned therein. Otherwise, a new array is allocated with the runtime type of the specified array and the size of this collection.

If this collection fits in the specified array with room to spare (i.e., the array has more elements than this collection), the element in the array immediately following the end of the collection is set to null. (This is useful in determining the length of this collection only if the caller knows that this collection does not contain any null elements.)

If this collection makes any guarantees as to what order its elements are returned by its iterator, this method must return the elements in the same order.

Parameters
<T>
the component type of the array to contain the collection
array:T[]

the array into which the elements of this collection are to be stored, if it is big enough; otherwise, a new array of the same runtime type is allocated for this purpose.

Returns:T[]

an array containing all of the elements in this collection

Annotations
@Override
@SuppressWarnings:nullness
toStringback to summary
public String toString()

Overrides com.google.common.collect.ForwardingObject.toString.

Implements com.google.common.collect.Multiset.toString.

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

It is recommended, though not mandatory, that this method return the result of invoking toString on the entrySet, yielding a result such as [a x 3, c, d x 2, e].

Returns:String

Doc from java.lang.Object.toString.

a string representation of the object.

Annotations
@Override